Skip to main content

External Access to Purchase Order records (Admin)

Allows you to connect externally to the system administrator's internal records to query the purchase order records associated with the service sessions held between agents and customers, all of this through an endpoint that connects to the API to query those records using a unique authorization token

External Access - Admin - index (session order)​

GET /v1/access/external/admin/session-orders?timeZone=America/Santiago

This endpoint returns the list of the users' purchase orders.

Endpoint​

https://api.ocularsolution.com/api/v1/access/external/admin/session-orders?timeZone=America/Santiago

Headers​

Authorization STRING REQUIRED

Example values: 123456789


X-Requested-With STRING REQUIRED

Example values: XMLHttpRequest


Parameters​

start TIMESTAMP OPTIONAL

Date range for filtering; must be in timestamp format

Example values: 2022-03-24 01:26:04


end TIMESTAMP OPTIONAL

Date range for filtering; must be in timestamp format

Example values: 2022-03-25 01:26:04


externalId STRING REQUIRED

optional: filters an order by its external Id

Example values: ORDER-8459


sessionOrderStateId NUMBER REQUIRED

optional: filters orders by state, for example "pending" or "cancelled"; the id 1, 2 or 3 must be sent

Example values: 2


timeZone STRING REQUIRED

Time zone

Example values: America/Santiago


paginate NUMBER REQUIRED

pagination returns 50 rows by default, with a cap of 100; if a higher number is sent, the service returns a maximum of 100 rows

Example values: 2


movementStart TIMESTAMP REQUIRED

Start date of the history entries

Example values: 2022-03-24 00:00:00


movementEnd TIMESTAMP REQUIRED

End date of the history entries

Example values: 2022-03-25 01:26:04


userId NUMBER REQUIRED

Filters orders by user id

Example values: 7


Service responses​

Successful response​

Response
{
"statusCode": 0,
"message": "Success",
"sessionOrders": {
"data": {
"current_page": 1,
"data": [
{
"id": 29,
"session_id": 1184,
"external_id": "R416577272",
"session_order_state_id": 2,
"created_at": "2022-04-11T14:54:39.000000Z",
"updated_at": "2022-04-11T14:54:39.000000Z",
"session_order_history": [
{
"session_order_id": 29,
"detail": "Orden de compra creada",
"created_at": "2022-04-11T14:54:39.000000Z",
"state": "Pendiente"
},
{
"session_order_id": 29,
"detail": "Se actualizo el estado de la orden de compra",
"created_at": "2022-04-11T14:54:39.000000Z",
"state": "Pagada"
}
],
"session_order_items": [
{
"session_order_id": 29,
"quantity": "1",
"unit_price": false,
"price": "29899.00",
"discount_type": "amount ",
"discount": "0.00",
"include_tax": true,
"tax_value": "19.0",
"currency": "CLP ",
"external_id": "578066",
"name": "Crema Multi Acción Pieles Maduras",
"image": "https://d3ha5eby3vwk14.cloudfront.net/spree/products/55251/small/578066.jpg?1619124336",
"description": "Cuidado nutritivo específico para la piel más madura gracias a su suave y sedosa textura.",
"brand": null,
"variants": [
{
"name": "Formato",
"value": "50 ml"
}
],
"category": null
}
],
"session_order_state": {
"id": 2,
"name": "Pagada"
},
"session": {
"id": 1184,
"user_id": 17,
"user": {
"id": 17,
"name": "Agente Demo",
"email": "
agente01@staging.salcobrandonline.cl
",
"profile_image": "
https://ocular-prod.s3.us-east-2.amazonaws.com/brand/1/default-cammer.png",
"user_info": []
}
}
}
],
"first_page_url": "http://apidev.ocularsolution.com/api/v1/access/external/admin/session-orders?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://apidev.ocularsolution.com/api/v1/access/external/admin/session-orders?page=1",
"links": [
{
"url": null,
"label": "« Anterior",
"active": false
},
{
"url": "http://apidev.ocularsolution.com/api/v1/access/external/admin/session-orders?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Siguiente »",
"active": false
}
],
"next_page_url": null,
"path": "http://apidev.ocularsolution.com/api/v1/access/external/admin/session-orders",
"per_page": "2",
"prev_page_url": null,
"to": 1,
"total": 1
}
}
}

Failed response​

{
"statusCode": 2,
"message": "Campos no cumplen",
"detail": {
"timeZone": [
"SessionOrderControllerValidator: time zone is required."
]
}
}

External Access - Admin - getOrganizationCammers​

GET /v1/access/external/admin/cammers?withSessionOrder=1

This endpoint returns the list of all users belonging to the organization. If the parameter withSessionOrder is passed with the value 1, it returns only the users that have an associated purchase order.

Endpoint​

https://api.ocularsolution.com/api/v1/access/external/admin/cammers?withSessionOrder=1

Headers​

Authorization STRING REQUIRED

Example values: 123456789


X-Requested-With STRING REQUIRED

Example values: XMLHttpRequest


Parameters​

withSessionOrder STRING REQUIRED

optional: if equal to "1", filters the organization's users that have an associated purchase order; if not sent, the service returns all of the organization's users.

Example values: 1


Service responses​

Successful response​

{
"statusCode": 0,
"message": "Success",
"users": {
"data": [
{
"id": 3,
"name": "Abraham Rivas",
"email": "abraham@ocularsolution.com",
"profile_image": "https://ocular-prod.s3.us-east-2.amazonaws.com/brand/1/default-cammer.png",
"organization_id": 1,
"dni": null
},
{
"id": 14,
"name": "Allan Mendez",
"email": "amendez@wingsoft.com",
"profile_image": "https://ocular-prod.s3.us-east-2.amazonaws.com/brand/1/default-cammer.png",
"organization_id": 1,
"dni": null
},
{
"id": 15,
"name": "Miguel Zolk",
"email": "zolkmiguel@gmail.com",
"profile_image": "https://ocular-prod.s3.us-east-2.amazonaws.com/brand/1/default-cammer.png",
"organization_id": 1,
"dni": null
}
]
}
}

Failed response​

{
"statusCode": 9,
"message": "organizationConfigAccessToken not found"
}

External Access - Admin - listStates (Session Order State)​

GET /v1/access/external/admin/session-order-states

This endpoint returns the list of purchase order states to be used in filters.

Endpoint​

https://api.ocularsolution.com/api/v1/access/external/admin/session-order-states

Headers​

Authorization STRING REQUIRED

Example values: 123456789


X-Requested-With STRING REQUIRED

Example values: XMLHttpRequest


Service responses​

Successful response​

{
"statusCode": 0,
"message": "Success",
"sessionOrderStates": {
"data": [
{
"id": 1,
"name": "Pendiente"
},
{
"id": 2,
"name": "Pagada"
},
{
"id": 3,
"name": "Cancelada"
}
]
}
}

Failed response​

{
"statusCode": 9,
"message": "organizationConfigAccessToken not found"
}