Despachos
Generación de documentos despacho. (Guías de despacho electrónicas), listar despachos generados, detalles incluidos en el despacho. Un despacho, siempre genera una salida de stock cuando hablamos de controlarlo.
Estructura JSON
Al realizar una petición HTTP, el servicio retornara un JSON con la siguiente estructura:
{
"href": "https://api.bsale.com.pe/v1/shippings/22.json",
"id": 22,
"shippingDate": 1370318400,
"address": null,
"district": "",
"city": "",
"recipient": null,
"state": 0,
"office": {
"href": "https://api.bsale.com.pe/v1/offices/1.json",
"id": "1"
},
"shipping_type": {
"href": "https://api.bsale.com.pe/v1/shipping_types/1.json",
"id": "1"
},
"guide": {
"href": "https://api.bsale.com.pe/v1/documents/23.json",
"id": "23"
},
"details": {
"href": "https://api.bsale.com.pe/v1/shippings/22/details.json"
}
}
href, url del despacho (String).
id, identificador único del despacho (Integer).
shippingDate, fecha del despacho (Integer).
address, dirección del despacho (String).
district, distrito del despacho (String).
city, ciudad del despacho (String).
recipient, destinatario del despacho (String).
state, estado del descuento indica si el descuento esta activo(0) o inactivo (1) (Boolean).
office, nodo que indica la relación con la sucursal en la que fue emitida el despacho.
shipping_type, nodo que indica la relación con el tipo de despacho.
guide, nodo que indica el documento guía de despacho.
details, nodo que indica los detalles del despacho.
GET lista de despachos
GET /v1/shippings.json retornara todos los despachos.
####Parametros
limit, limita la cantidad de items de una respuesta JSON, por defecto el limit es 25, el máximo permitido es 50.
offset, permite paginar los items de una respuesta JSON, por defecto el offset es 0.
fields, solo devolver atributos específicos de un recurso
expand, permite expandir instancias y colecciones.
shippingdate, Permite filtrar por fecha de devolución.
officeid, Permite filtrar por sucursal.
shippingtypeid, filtra por documento de referencia.
state, boolean (0 o 1) indica si los documentos están activos(0) inactivos (1).
####Ejemplos
GET /v1/shippings.json?limit=10&offset=0
GET /v1/shippings.json?fields=[shippingdate,recipient]
GET /v1/shippings.json?expand=[guide,shipping_type,details]
####Respuesta
{
"href": "https://api.bsale.com.pe/v1/shippings.json",
"count": 13430,
"limit": 3,
"offset": 0,
"items": [
{
"href": "https://api.bsale.com.pe/v1/shippings/22.json",
"id": 22,
"shippingDate": 1370318400,
"address": null,
"district": "",
"city": "",
"recipient": null,
"state": 0,
"office": {
"href": "https://api.bsale.com.pe/v1/offices/1.json",
"id": "1"
},
"shipping_type": {
"href": "https://api.bsale.com.pe/v1/shipping_types/1.json",
"id": "1"
},
"guide": {
"href": "https://api.bsale.com.pe/v1/documents/23.json",
"id": "23"
},
"details": {
"href": "https://api.bsale.com.pe/v1/shippings/22/details.json"
}
},
{
"href": "https://api.bsale.com.pe/v1/shippings/23.json",
"id": 23,
"shippingDate": 1370318400,
"address": null,
"district": "",
"city": "",
"recipient": null,
"state": 0,
"office": {
"href": "https://api.bsale.com.pe/v1/offices/1.json",
"id": "1"
},
"shipping_type": {
"href": "https://api.bsale.com.pe/v1/shipping_types/1.json",
"id": "1"
},
"guide": {
"href": "https://api.bsale.com.pe/v1/documents/24.json",
"id": "24"
},
"details": {
"href": "https://api.bsale.com.pe/v1/shippings/23/details.json"
}
},
{
"href": "https://api.bsale.com.pe/v1/shippings/24.json",
"id": 24,
"shippingDate": 1370318400,
"address": null,
"district": "",
"city": "",
"recipient": null,
"state": 0,
"office": {
"href": "https://api.bsale.com.pe/v1/offices/1.json",
"id": "1"
},
"shipping_type": {
"href": "https://api.bsale.com.pe/v1/shipping_types/1.json",
"id": "1"
},
"guide": {
"href": "https://api.bsale.com.pe/v1/documents/25.json",
"id": "25"
},
"details": {
"href": "https://api.bsale.com.pe/v1/shippings/24/details.json"
}
}
]
}
GET único despacho
GET /v1/shippings/22.json retornara un despacho específico.
####Parametros
expand, permite expandir instancias y colecciones.
####Ejemplos
GET /v1/shippings/1.json?expand=[details]
####Respuesta
{
"href": "https://api.bsale.com.pe/v1/shippings/22.json",
"id": 22,
"shippingDate": 1370318400,
"address": null,
"district": "",
"city": "",
"recipient": null,
"state": 0,
"office": {
"href": "https://api.bsale.com.pe/v1/offices/1.json",
"id": "1"
},
"shipping_type": {
"href": "https://api.bsale.com.pe/v1/shipping_types/1.json",
"id": "1"
},
"guide": {
"href": "https://api.bsale.com.pe/v1/documents/23.json",
"id": "23"
},
"details": {
"href": "https://api.bsale.com.pe/v1/shippings/22/details.json"
}
}
GET detalles de un despacho
GET /v1/shippings/22/details.json
{
"href": "https://api.bsale.com.pe/v1/shippings/22/details.json",
"count": 1,
"limit": 25,
"offset": 0,
"items": [
{
"href": "https://api.bsale.com.pe/v1/shippings/22/details/31.json",
"id": 31,
"quantity": 1.0,
"variantStock": 28.0,
"variantCost": 0.0,
"variant": {
"href": "https://api.bsale.com.pe/v1/variants/8.json",
"id": "8"
}
}
]
}
GET un detalle de un despacho
GET /v1/shippings/22/details/31.json
{
"href": "https://api.bsale.com.pe/v1/shippings/22/details/31.json",
"id": 31,
"quantity": 1.0,
"variantStock": 28.0,
"variantCost": 0.0,
"variant": {
"href": "https://api.bsale.com.pe/v1/variants/8.json",
"id": "8"
}
}