Clientes

Listar, crear, editar y eliminar clientes. Además podrás consultar pagos a clientes, contar clientes, ver documentos por cliente, agregar direcciones adicionales (casa matriz, sucursal a, b, etc). Endpoints para gestionar tus clientes en Bsale.

  • Cómo funciona el Front-end de Bsale, mira éstos videos: (ver)

Estructura JSON

Al realizar una petición HTTP, el servicio retornara un JSON con la siguiente estructura:

{

"href": "https://api.bsale.cl/v1/clients.json",

"count": 2,

"limit": 25,

"offset": 0,

"items": [

{

"href": "https://api.bsale.cl/v1/clients/2.json",

"id": 2,

"firstName": "Francisco",

"lastName": "Pullnm",

"email": "fpull@gmail.com",

"state": 0,

"office": {

"href": "https://api.bsale.cl/v1/offices/1.json",

"id": "1"

}

},

{

"href": "https://api.bsale.cl/v1/clients/1.json",

"id": 1,

"firstName": "Asistente",

"lastName": "bsale",

"email": "ayuda@bsale.app",

"state": 0,

"office": {

"href": "https://api.bsale.cl/v1/offices/1.json",

"id": "1"

}

}

]

}


  • href, url del cliente (String).

  • id, identificador único del cliente (Integer).

  • firstName, nombre del cliente (String).

  • lastName, apellido del cliente (String).

  • code, rut del cliente (String).

  • phone, teléfono del cliente (String).

  • company, empresa del cliente (String).

  • note, una descripción del cliente (String).

  • facebook, facebook del cliente (String).

  • twitter, twitter del cliente.

  • hasCredit, indica si el cliente posee crédito No(0) o Si(1) (Boolean).

  • maxCredit, monto máximo de crédito del cliente (Float).

  • state, estado del cliente indica si esta activo(0) o inactivo (1) (Boolean).

  • activity, giro del cliente (String).

  • city, ciudad del cliente (String).

  • municipality, comuna del cliente (String).

  • companyOrPerson, indica si el cliente es persona natural o empresa (0)Persona o (1)Empresa (Boolean).

  • points, cantidad de puntos acumulados del cliente (Integer).

  • pointsUpdated, fecha de la última actualización de puntos (Integer).

  • accumulatePoints, indica si el cliente acumula puntos No(0) o Si(1) (Boolean).

  • sendDte, indica si al cliente se le envía el XML del DTE No(0) o Si(1) (Boolean).

  • prestashopClienId, identificador en prestashop (String).

  • contacts, nodo que indica la relación con los contactos del cliente.

  • attributes, nodo que indica la relación con los atributos adicionales de un cliente.

  • addresses, nodo que indica la relación con las direcciones adicionales de un cliente.

GET lista de clientes

  • GET /v1/clients.json retornara todos los clientes.

Parámetros

  • 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.

  • code, Permite filtrar por rut del cliente.

  • firstname, filtra los clientes por nombre.

  • lastname, filtra los clientes por apellido.

  • email, filtra los clientes por email.

  • paymenttypeid, recupera los clientes con forma de pago.

  • salesconditionid, recupera los clientes por la condición de venta.

  • state, boolean (0 o 1) indica si los clientes están activos(0) inactivos (1).

Ejemplos

  • GET /v1/clients.json?limit=10&offset=0

  • GET /v1/clients.json?fields=[firstname,lastname]

  • GET /v1/clients.json?code=1-9

  • GET /v1/clients.json?paymenttypeid=1

  • GET /v1/clients.json?expand=[contacts,attributes,payment_type]

Respuesta

{

"href": "https://api.bsale.cl/v1/clients.json",

"count": 112,

"limit": 25,

"offset": 0,

"items": [

{

"href": "https://api.bsale.cl/v1/clients/65.json",

"id": 65,

"firstName": "a",

"lastName": "sa",

"code": "92.341.000-7",

"phone": "",

"company": "a sa",

"note": "",

"facebook": "",

"twitter": "",

"hasCredit": 1,

"maxCredit": "10000.0",

"state": 1,

"activity": "Sin Giro",

"city": "",

"municipality": "",

"address": "",

"companyOrPerson": 0,

"points": 0,

"pointsUpdated": "",

"accumulatePoints": 0,

"sendDte": 0,

"prestashopClienId": 0,

"contacts": {

"href": "https://api.bsale.cl/v1/clients/65/contacts.json"

},

"attributes": {

"href": "https://api.bsale.cl/v1/clients/65/attributes.json"

},

"addresses": {

"href": "https//api.bsale.cl/v1/clients/65/addresses.json"

}

},

{

"href": "https://api.bsale.cl/v1/clients/102.json",

"id": 102,

"firstName": "Adriana",

"lastName": "Talhouk",

"code": "",

"phone": "",

"company": "Adriana Talhouk",

"note": null,

"facebook": null,

"twitter": "",

"hasCredit": 1,

"maxCredit": "10000.0",

"state": 0,

"activity": "Sin Giro",

"city": "",

"municipality": "",

"address": "",

"companyOrPerson": 0,

"points": 0,

"pointsUpdated": "",

"accumulatePoints": 0,

"sendDte": 0,

"prestashopClienId": 0,

"contacts": {

"href": "https://api.bsale.cl/v1/clients/102/contacts.json"

},

"attributes": {

"href": "https://api.bsale.cl/v1/clients/102/attributes.json"

},

"addresses": {

"href": "https//api.bsale.cl/v1/clients/102/addresses.json"

}

}

]

}


GET único cliente

  • GET /v1/clients/80.json retornara un cliente específico.

Parámetros

  • expand, permite expandir instancias y colecciones.

Ejemplos

  • GET /v1/clients/80.json?expand=[contacts,payment_type]

Respuesta

{

"href": "https://api.bsale.cl/v1/clients/80.json",

"id": 80,

"firstName": "juanito",

"lastName": "mena",

"code": "",

"phone": "",

"company": "juanito mena",

"note": null,

"facebook": null,

"twitter": "",

"hasCredit": 1,

"maxCredit": "10000.0",

"state": 0,

"activity": "Sin Giro",

"city": "",

"municipality": "",

"address": "",

"companyOrPerson": 0,

"points": 113000,

"pointsUpdated": 1437577975,

"accumulatePoints": 1,

"sendDte": 0,

"prestashopClienId": 0,

"contacts": {

"href": "https://api.bsale.cl/v1/clients/80/contacts.json"

},

"attributes": {

"href": "https://api.bsale.cl/v1/clients/80/attributes.json"

},

"addresses": {

"href": "https//api.bsale.cl/v1/clients/80/addresses.json"

}

}


GET lista de contactos de un cliente

  • GET /v1/clients/55/contacts.json

{

"href": "https://api.bsale.cl/v1/clients/4/contacts.json",

"count": 2,

"limit": 25,

"offset": 0,

"items": [

{

"href": "https://api.bsale.cl/v1/clients/4/contacts/31.json",

"id": 31,

"firstName": "Andres",

"lastName": "Villanueva",

"phone": "2220936",

"email": "a.villanueva@gmail.cl"

},

{

"href": "https://api.bsale.cl/v1/clients/4/contacts/32.json",

"id": 32,

"firstName": "Juana ",

"lastName": "Jeldres",

"phone": "2220928",

"email": "recepcion@gmail.cl"

}

]

}


GET un único contacto de un cliente

  • GET /v1/clients/4/contacts/31.json

{

"href": "https://api.bsale.cl/v1/clients/4/contacts/31.json",

"id": 31,

"firstName": "Andres",

"lastName": "Villanueva",

"phone": "2220936",

"email": "a.villanueva@gmail.cl"

}


POST un contacto de un cliente

  • POST /v1/clients/55/contacts.json

Se debe enviar un Json con la siguiente estructura.

{

"firstName": "Juan",

"lastName": "Matamala",

"phone": "966542311",

"email": "jmatamala@gmail.com"

}


Respuesta

{

"href": "https://api.bsale.cl/v1/clients/55/contacts/1.json",

"id": 1,

"firstName": "Juan",

"lastName": "Matamala",

"phone": "966542311",

"email": "jmatamala@gmail.com"

}


DELETE un contacto de un cliente

  • DELETE /v1/clients/55/contacts/1.json elimina el contacto respondiendo un estado HTTP 204

GET lista de direcciones de un cliente

  • GET /v1/clients/55/addresses.json

Parámetros

  • address, permite filtrar por dirección (String).

  • city, permite filtrar por ciudad (String).

  • municipality, permite filtrar por comuna (String).

  • state, permite filtrar por estado (Boolean).

Ejemplos

  • GET /v1/clients/55/addresses.json?address=la quebrada 1189

  • GET /v1/clients/55/addresses.json?city=santiago

  • GET /v1/clients/55/addresses.json?city=santiago&municipality=providencia

  • GET /v1/clients/55/addresses.json?state=0

{

"href": "https://api.bsale.cl/v1/clients/55/addresses.json",

"count": 2,

"limit": 25,

"offset": 0,

"items": [

{

"href": "https://api.bsale.cl/v1/clients/55/addresses/8.json",

"id": 8,

"addressName": "SUC 1",

"address": "SOTERO SANZ 100",

"city": "STGO",

"municipality": "PROVIDENCIA",

"state": 0

},

{

"href": "https://api.bsale.cl/v1/clients/55/addresses/9.json",

"id": 9,

"addressName": "SUC 2",

"address": "PEDRO DE VALDIVIA 200",

"city": "STGO",

"municipality": "PROVIDENCIA",

"state": 0

}

]

}


GET una única dirección de un cliente

  • GET /v1/clients/55/addresses/8.json

{

"href": "https://api.bsale.cl/v1/clients/55/addresses/8.json",

"id": 8,

"addressName": "SUC 1",

"address": "SOTERO SANZ 100",

"city": "STGO",

"municipality": "PROVIDENCIA",

"state": 0

}


POST una dirección de un cliente

  • POST /v1/clients/55/addresses.json

Se debe enviar un Json con la siguiente estructura.

{

"addressName": "SUC 3",

"address": "NUNCIO MONSEÑOR SOTERO SANZ 100, OF. 401",

"city": "STGO",

"municipality": "PROVIDENCIA"

}


Respuesta

{

"href": "https://api.bsale.cl/v1/clients/55/addresses/6.json",

"id": 6,

"addressName": "SUC 3",

"address": "NUNCIO MONSEÑOR SOTERO SANZ 100, OF. 401",

"city": "STGO",

"municipality": "PROVIDENCIA",

"state": 0

}


PUT una dirección de un cliente

  • PUT /v1/clients/55/addresses/6.json

Se debe enviar un Json con la siguiente estructura.

{

"addressName": "SUC 4",

"address": "OF. 401",

"city": "STGO",

"municipality": "PROVIDENCIA"

}


Respuesta

{

"href": "https://api.bsale.cl/v1/clients/55/addresses/6.json",

"id": 6,

"addressName": "SUC 4",

"address": "OF. 401",

"city": "STGO",

"municipality": "PROVIDENCIA",

"state": 0

}


DELETE una dirección de un cliente

  • DELETE /v1/clients/55/addresses/6.json cambia el estado de una dirección.

Respuesta

{

"href": "https://api.bsale.cl/v1/clients/55/addresses/6.json",

"id": 6,

"addressName": "SUC 4",

"address": "OF. 401",

"city": "STGO",

"municipality": "PROVIDENCIA",

"state": 1

}


GET atributos de un cliente

  • GET /v1/clients/796/attributes.json

Respuesta

{

"href": "https://api.bsale.cl/v1/clients/796/attributes.json",

"count": 4,

"limit": 25,

"offset": 0,

"items": [

{

"href": "https://api.bsale.cl/v1/dynamic_attributes/44.json",

"id": 44,

"name": "Rubro",

"value": ""

},

{

"href": "https://api.bsale.cl/v1/dynamic_attributes/72.json",

"id": 72,

"name": "NOMBRE FANTASIA",

"value": ""

},

{

"href": "https://api.bsale.cl/v1/dynamic_attributes/73.json",

"id": 73,

"name": "wefcqwrevgrqebvqerbv",

"value": ""

},

{

"href": "https://api.bsale.cl/v1/dynamic_attributes/76.json",

"id": 76,

"name": "Número Cliente",

"value": ""

}

]

}


GET cantidad de clientes

  • GET /v1/clients/count.json

Parámetros

  • state, permite filtrar por estado, activos (0) inactivos (1).

Respuesta

{

"count": 66

}


GET documentos de venta

  • GET /v1/clients/purchases.json

Parámetros

  • clientid, Permite filtrar por id del cliente.

  • code, Permite filtrar por rut del cliente.

Ejemplos

  • GET /v1/clients/unpaid_documents.json?code=7513098-8

  • GET /v1/clients/unpaid_documents.json?clientid=7

Respuesta

{

"href": "https://api.bsale.cl/v1/documents.json",

"count": 43,

"limit": 3,

"offset": 0,

"items": [

{

"href": "https://api.bsale.cl/v1/documents/1.json",

"id": 1,

"emissionDate": 1519084800,

"expirationDate": 1519084800,

"generationDate": 1519147082,

"number": 1,

"totalAmount": 12979,

"netAmount": 10907,

"taxAmount": 2072,

"exemptAmount": 0,

"exportTotalAmount": 0,

"exportNetAmount": 0,

"exportTaxAmount": 0,

"exportExemptAmount": 0,

"commissionRate": 0,

"commissionNetAmount": 0,

"commissionTaxAmount": 0,

"commissionTotalAmount": 0,

"percentageTaxWithheld": 0,

"purchaseTaxAmount": 0,

"purchaseTotalAmount": 0,

"address": "Cerro El Plomo 5855, Las Condes, Chile",

"municipality": "Las Condes",

"city": "Chile",

"urlTimbre": null,

"ted": null,

"urlPublicView": "http://app2.bsale.cl/view/18790/d132cb4d5f82?sfd=99",

"urlPdf": "http://app2.bsale.cl/view/18790/d132cb4d5f82.pdf?sfd=99",

"urlPublicViewOriginal": "http://app2.bsale.cl/view/18790/d132cb4d5f82",

"urlPdfOriginal": "http://app2.bsale.cl/view/18790/d132cb4d5f82.pdf",

"token": "d132cb4d5f82",

"state": 0,

"urlXml": "https://api.bsale.cl/v1/18790/files/d132cb4d5f82.xml",

"informedSii": 2,

"responseMsgSii": null,

"document_type": {

"href": "https://api.bsale.cl/v1/document_types/5.json",

"id": "5"

},

"client": {

"href": "https://api.bsale.cl/v1/clients/412.json",

"id": "412"

},

"office": {

"href": "https://api.bsale.cl/v1/offices/1.json",

"id": "1"

},

"user": {

"href": "https://api.bsale.cl/v1/users/5.json",

"id": "5"

},

"coin": {

"href": "https://api.bsale.cl/v1/coins/1.json",

"id": "1"

},

"references": {

"href": "https://api.bsale.cl/v1/documents/1/references.json"

},

"document_taxes": {

"href": "https://api.bsale.cl/v1/documents/1/document_taxes.json"

},

"details": {

"href": "https://api.bsale.cl/v1/documents/1/details.json"

},

"sellers": {

"href": "https://api.bsale.cl/v1/documents/1/sellers.json"

},

"attributes": {

"href": "https://api.bsale.cl/v1/documents/1/attributes.json"

}

},

{

"href": "https://api.bsale.cl/v1/documents/25.json",

"id": 25,

"emissionDate": 1519257600,

"expirationDate": 1519257600,

"generationDate": 1519309484,

"number": 1,

"totalAmount": 123456789,

"netAmount": 103745201,

"taxAmount": 19711588,

"exemptAmount": 0,

"exportTotalAmount": 0,

"exportNetAmount": 0,

"exportTaxAmount": 0,

"exportExemptAmount": 0,

"commissionRate": 0,

"commissionNetAmount": 0,

"commissionTaxAmount": 0,

"commissionTotalAmount": 0,

"percentageTaxWithheld": 0,

"purchaseTaxAmount": 0,

"purchaseTotalAmount": 0,

"address": "Cerro El Plomo 5855, Las Condes, Chile",

"municipality": "Las Condes",

"city": "Chile",

"urlTimbre": null,

"ted": null,

"urlPublicView": "http://app2.bsale.cl/view/18790/8a350bb0a82d?sfd=99",

"urlPdf": "http://app2.bsale.cl/view/18790/8a350bb0a82d.pdf?sfd=99",

"urlPublicViewOriginal": "http://app2.bsale.cl/view/18790/8a350bb0a82d",

"urlPdfOriginal": "http://app2.bsale.cl/view/18790/8a350bb0a82d.pdf",

"token": "8a350bb0a82d",

"state": 0,

"urlXml": "https://api.bsale.cl/v1/18790/files/8a350bb0a82d.xml",

"informedSii": 2,

"responseMsgSii": null,

"document_type": {

"href": "https://api.bsale.cl/v1/document_types/3.json",

"id": "3"

},

"client": {

"href": "https://api.bsale.cl/v1/clients/412.json",

"id": "412"

},

"office": {

"href": "https://api.bsale.cl/v1/offices/1.json",

"id": "1"

},

"user": {

"href": "https://api.bsale.cl/v1/users/3.json",

"id": "3"

},

"coin": {

"href": "https://api.bsale.cl/v1/coins/1.json",

"id": "1"

},

"references": {

"href": "https://api.bsale.cl/v1/documents/25/references.json"

},

"document_taxes": {

"href": "https://api.bsale.cl/v1/documents/25/document_taxes.json"

},

"details": {

"href": "https://api.bsale.cl/v1/documents/25/details.json"

},

"sellers": {

"href": "https://api.bsale.cl/v1/documents/25/sellers.json"

},

"attributes": {

"href": "https://api.bsale.cl/v1/documents/25/attributes.json"

}

},

{

"href": "https://api.bsale.cl/v1/documents/2.json",

"id": 2,

"emissionDate": 1519084800,

"expirationDate": 1519084800,

"generationDate": 1519147134,

"number": 2,

"totalAmount": 3570,

"netAmount": 3000,

"taxAmount": 570,

"exemptAmount": 0,

"exportTotalAmount": 0,

"exportNetAmount": 0,

"exportTaxAmount": 0,

"exportExemptAmount": 0,

"commissionRate": 0,

"commissionNetAmount": 0,

"commissionTaxAmount": 0,

"commissionTotalAmount": 0,

"percentageTaxWithheld": 0,

"purchaseTaxAmount": 0,

"purchaseTotalAmount": 0,

"address": "Cerro El Plomo 5855, Las Condes, Chile",

"municipality": "Las Condes",

"city": "Chile",

"urlTimbre": null,

"ted": null,

"urlPublicView": "http://app2.bsale.cl/view/18790/960ca7eb7519?sfd=99",

"urlPdf": "http://app2.bsale.cl/view/18790/960ca7eb7519.pdf?sfd=99",

"urlPublicViewOriginal": "http://app2.bsale.cl/view/18790/960ca7eb7519",

"urlPdfOriginal": "http://app2.bsale.cl/view/18790/960ca7eb7519.pdf",

"token": "960ca7eb7519",

"state": 0,

"urlXml": "https://api.bsale.cl/v1/18790/files/960ca7eb7519.xml",

"informedSii": 2,

"responseMsgSii": null,

"document_type": {

"href": "https://api.bsale.cl/v1/document_types/5.json",

"id": "5"

},

"client": {

"href": "https://api.bsale.cl/v1/clients/412.json",

"id": "412"

},

"office": {

"href": "https://api.bsale.cl/v1/offices/1.json",

"id": "1"

},

"user": {

"href": "https://api.bsale.cl/v1/users/5.json",

"id": "5"

},

"coin": {

"href": "https://api.bsale.cl/v1/coins/1.json",

"id": "1"

},

"references": {

"href": "https://api.bsale.cl/v1/documents/2/references.json"

},

"document_taxes": {

"href": "https://api.bsale.cl/v1/documents/2/document_taxes.json"

},

"details": {

"href": "https://api.bsale.cl/v1/documents/2/details.json"

},

"sellers": {

"href": "https://api.bsale.cl/v1/documents/2/sellers.json"

},

"attributes": {

"href": "https://api.bsale.cl/v1/documents/2/attributes.json"

}

}

],

"next": "https://api.bsale.cl/v1/documents.json?limit=3&offset=3"

}


GET documentos pendientes de pago

  • GET /v1/clients/unpaid_documents.json

Parámetros

  • clientid, Permite filtrar por id del cliente.

  • code, Permite filtrar por rut del cliente.

  • comparisondate, Permite separar los documentos vencidos de los por vencer, por defecto es la fecha del momento de la consulta.

Ejemplos

  • GET /v1/clients/unpaid_documents.json?code=7513098-8

  • GET /v1/clients/unpaid_documents.json?clientid=1

  • GET /v1/clients/unpaid_documents.json?comparisondate=1437436800

  • GET /v1/clients/unpaid_documents.json?code=7513098-8&comparisondate=1437436800

Respuesta

{

"overdueDebt": 40000,

"upcomingDebt": 30000,

"totalDebt": 70000,

"client": {

"href": "https://api.bsale.cl/v1/clients/1.json",

"id": 1,

"firstName": "Roberto",

"lastName": "",

"code": "7513098-8",

"company": "Roberto Mancilla"

},

"overdue_documents": [

{

"href": "https://api.bsale.cl/v1/documents/6514.json",

"id": 6514,

"name": "Factura Electronica",

"number": 123123123217,

"emissionDate": 1437436800,

"expirationDate": 1437436800,

"totalAmount": 20000,

"totalAmountOwed": 20000

},

{

"href": "https://api.bsale.cl/v1/documents/6515.json",

"id": 6515,

"name": "Factura Electronica",

"number": 123123123218,

"emissionDate": 1437436800,

"expirationDate": 1437436800,

"totalAmount": 20000,

"totalAmountOwed": 20000

}

],

"upcoming_documents": [

{

"href": "https://api.bsale.cl/v1/documents/6520.json",

"id": 6520,

"name": "Factura Electronica",

"number": 123123123220,

"emissionDate": 1437523200,

"expirationDate": 1440201600,

"totalAmount": 30000,

"totalAmountOwed": 30000

}

]

}


  • overdueDebt, deuda vencida (Float).

  • upcomingDebt, deuda por vencer (Float).

  • totalDebt, deuda total (Float).

  • client, nodo que indica el cliente al cual se le emitieron los documentos.

  • overdue_documents, nodo que indica los documentos vencidos.

  • upcoming_documents, nodo que indica los documentos por vencer.

POST un cliente

  • POST /v1/clients.json

Se debe enviar un Json con la siguiente estructura.

{

"facebook": "",

"municipality": "Las Condes",

"phone": "66287196",

"activity": "Venta de ropa",

"city": "Santiago",

"maxCredit": 100000,

"hasCredit": 1,

"accumulatePoints": 1,

"lastName": "Muñoz",

"note": "Cliente premiun",

"firstName": "Marcela",

"company": "Particular",

"address": "Los trigales 372",

"email": "mmunoz@.email.cl",

"twitter": "",

"code": "2-7"

}


También se pueden enviar atributos dinámicos al momento de crear el cliente

{

"facebook": "",

"municipality": "Las Condes",

"phone": "66287196",

"activity": "Venta de ropa",

"city": "Santiago",

"maxCredit": 100000,

"hasCredit": 1,

"accumulatePoints": 1,

"lastName": "Muñoz",

"note": "Cliente premiun",

"firstName": "Marcela",

"company": "Particular",

"address": "Los trigales 372",

"email": "mmunoz@.email.cl",

"twitter": "",

"code": "2-7",

"dynamicAttributes": [

{

"description": "21/03/1983",

"dynamicAttributeId": 24

}

]

}


Respuesta

{

"companyOrPerson": 0,

"address": "Los trigales 372",

"lastName": "Muñoz",

"sendDte": 0,

"city": "Santiago",

"state": 0,

"twitter": "",

"firstName": "Marcela",

"id": 67,

"municipality": "Las Condes",

"maxCredit": 100000.0,

"accumulatePoints": 1,

"note": "Cliente premiun",

"phone": "66287196",

"contacts": {

"href": "https://api.bsale.cl/v1/clients/67/contacts.json"

},

"prestashopClienId": 0,

"activity": "Venta de ropa",

"hasCredit": 1,

"facebook": "",

"company": "Particular",

"code": "2-7",

"href": "https://api.bsale.cl/v1/clients/67.json"

}


PUT un cliente

  • PUT /v1/clients/67.json

Se debe enviar un Json con la siguiente estructura.

{

"id": "67",

"facebook": "",

"municipality": "Puerto Montt",

"phone": "66287196",

"activity": "Venta de ropa",

"city": "Puerto Montt",

"maxCredit": 100000,

"hasCredit": 1,

"lastName": "Muñoz",

"note": "Cliente premiun",

"firstName": "Marcela",

"company": "Particular",

"address": "Los trigales 372",

"email": "mmunoz@.email.cl",

"twitter": "",

"accumulatePoints": 1,

"priceListId": 0

}

Respuesta

{

"companyOrPerson": 0,

"address": "Los trigales 372",

"lastName": "Muñoz",

"sendDte": 0,

"city": "Puerto Montt",

"state": 0,

"twitter": "",

"firstName": "Marcela",

"id": 67,

"municipality": "Puerto Montt",

"maxCredit": 100000.0,

"accumulatePoints": 1,

"note": "Cliente premiun",

"phone": "66287196",

"contacts": {

"href": "https://api.bsale.cl/v1/clients/67/contacts.json"

},

"prestashopClienId": 0,

"activity": "Venta de ropa",

"hasCredit": 1,

"facebook": "",

"company": "Particular",

"code": "2-7",

"href": "https://api.bsale.cl/v1/clients/67.json"

}

DELETE un cliente

  • DELETE /v1/clients/30.json cambia el estado del cliente.

{

"href": "https://api.bsale.cl/v1/clients/30.json",

"id": 30,

"firstName": "Andres",

"lastName": "Vasquez",

"code": "1-9",

"phone": "220800",

"company": "Servicios varios",

"note": "",

"facebook": "",

"twitter": "",

"hasCredit": 1,

"maxCredit": "9100",

"state": 1,

"activity": "",

"city": "Puerto Montt",

"municipality": "Puerto Montt",

"address": "Avda. Diego Portales 100",

"companyOrPerson": 1,

"sendDte": 0,

"prestashopClienId": 0,

"payment_type": {

"href": "https://api.bsale.cl/v1/payment_types/2.json",

"id": "2"

},

"sale_condition": {

"href": "https://api.bsale.cl/v1/sale_conditions/1.json",

"id": "2"

},

"contacts": {

"href": "https://api.bsale.cl/v1/clients/30/contacts.json"

}

}


PUT Puntos de un cliente

  • PUT /v1/clients/points.json

Parámetros

  • type, 0 aumenta, 1 resta puntos (Boolean)

  • clientId, Id de cliente (integer).

  • description, Descripción asociada al registro (String)

  • points, Cantidad de puntos a registrar (integer)

  • orderId, Id registro asociado (opcional) (String)

Se debe enviar un Json con la siguiente estructura.

{

"type": 0,

"clientId": 18,

"description": "Suma puntos 2",

"points": 1,

"orderId": "1"

}