Descripción web

Listar productos, variantes publicados en la tienda en línea

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

{
    "code": "200",
    "href": "https://api.bsale.io?&mkId=1&priceList=5",
    "count": 17,
    "limit": 25,
    "offset": 0,
    "data": [
        {
            "id": 25,
            "productId": 89,
            "idVariantDefault": 159,
            "urlSlug": "disco-externo-4tb-2-5-usb-3-0-portable-expansion",
            "name": "Disco Externo 4TB 2.5 USB 3.0 Portable Expansión",
            "description": "<p>Una espaciosa capacidad de 4 TB .... por un duradero diseño y una excepcional fiabilidad.</p>",
            "descriptions": {
                "href": "https://api.bsale.io/v2/products/market_info/25.json?expand=[descriptions]"
            },
            "displayNotice": "",
            "state": 1,
            "mkProductType": "normal",
            "productType": {
                "id": 13,
                "href": "https://api.bsale.io/v2/product_types/13.json"
            },
            "productTaxes": {
                "href": "https://api.bsale.io/v2/products/89/product_taxes.json"
            },
            "urlImg": "https://s3.amazonaws.com/bsalemarket/33250/product/4008249.jpg",
            "pictures": {
                "href": "https://api.bsale.io/v2/products/market_info/25/pictures.json"
            },
            "urlVideo": "https://www.youtube.com/watch?v=7V3f2ymkoME",
            "shippingUnit": null,
            "width": null,
            "depth": null,
            "length": null,
            "baseInfo": {
                "id": 89,
                "name": "Disco Externo 4TB 2.5 USB 3.0 Portable Expansión",
                "classification": 0,
                "stockControl": 0,
                "href": "https://api.bsale.io/v2/products/89.json"
            },
            "variant": {
                "id": 159,
                "price": 117638.655462185,
                "description": "",
                "finalPrice": 139990,
                "fpWithoutDiscount": 139990,
                "taxPrice": 22351.34,
                "taxDiscountPrice": 22351.34,
                "netDiscountPrice": 117638.66,
                "unlimitedStock": 0,
                "allowDecimal": 0,
                "allowNegativeStock": 1,
                "code": "SEAG1250",
                "discount": {
                    "percent": 0,
                    "minimumQuantity": 0
                }
            },
            "variants": {
                "href": "https://api.bsale.io/v2/products/market_info/25/variants.json"
            },
            "discounts": null,
            "stocks": {
                "href": "https://api.bsale.io/v2/stocks.json?product=89"
            },
            "integration": null,
            "order": 8
        }
  • href, url del producto (String).
  • productId, identificador único del producto (Integer).
  • idVariantDefault, id variante por defecto del producto (Integer).
  • description, descripción del producto (String).
  • state:
  • mkProductType:
  • productType:
  • productTaxes:
  • urlImg:
  • pictures:
  • urlVideo:
  • shippingUnit:
  • width:
  • depth:
  • length:
  • variant:
  • discounts:
  • stocks:
  • integration:
  • order:

GET lista de productos

  • GET /v1/products.json retornara todos los productos.

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.
  • name, Permite filtrar por nombre del producto.
  • ledgeraccount, filtra por cuenta contable de los productos.
  • costcenter, filtra centro de costo de los productos.
  • producttypeid, filtra por tipo de producto.
  • state, boolean (0 o 1) indica si los productos están activos(0) inactivos (1).

Ejemplos

  • GET /v1/products.json?limit=10&offset=0
  • GET /v1/products.json?fields=[name,ledgeraccount,description]
  • GET /v1/products.json?producttypeid=1
  • GET /v1/products.json?expand=[product_type]
  • GET /v1/products.json?classification=3

Respuesta

{
  "href": "https://api.bsale.cl/v1/products.json",
  "count": 693,
  "limit": 3,
  "offset": 0,
  "items": [
    {
      "href": "https://api.bsale.cl/v1/products/731.json",
      "id": 731,
      "name": "11% Avalúo Fiscal Depto 515,",
      "description": null,
      "classification": 1,
      "ledgerAccount": "",
      "costCenter": "",
      "allowDecimal": 0,
      "stockControl": 0,
      "printDetailPack": 0,
      "state": 0,
      "prestashopProductId": 0,
      "presashopAttributeId": 0,
      "product_type": {
        "href": "https://api.bsale.cl/v1/product_types/1.json",
        "id": "1"
      },
      "product_taxes": {
        "href": "https://api.bsale.cl/v1/products/731/product_taxes.json"
      }
    },
    {
      "href": "https://api.bsale.cl/v1/products/474.json",
      "id": 474,
      "name": "24 clases 3 veces a la semana",
      "description": null,
      "classification": 3,
      "ledgerAccount": "",
      "costCenter": "",
      "allowDecimal": 0,
      "stockControl": 0,
      "printDetailPack": 0,
      "state": 0,
      "prestashopProductId": 0,
      "presashopAttributeId": 0,
      "product_type": {
        "href": "https://api.bsale.cl/v1/product_types/1.json",
        "id": "1"
      },
      "product_taxes": {
        "href": "https://api.bsale.cl/v1/products/474/product_taxes.json"
      }
    },
    {
      "href": "https://api.bsale.cl/v1/products/703.json",
      "id": 703,
      "name": "2x1",
      "description": null,
      "classification": 3,
      "ledgerAccount": null,
      "costCenter": null,
      "allowDecimal": 0,
      "stockControl": 0,
      "printDetailPack": 0,
      "state": 0,
      "prestashopProductId": 0,
      "presashopAttributeId": 0,
      "product_type": {
        "href": "https://api.bsale.cl/v1/product_types/1.json",
        "id": "1"
      },
      "product_taxes": {
        "href": "https://api.bsale.cl/v1/products/703/product_taxes.json"
      }
    }
  ],
  "next": "https://api.bsale.cl/v1/products.json?limit=3&offset=3"
}

GET un producto

  • GET /v1/products/62.json retornara un producto específico.

Parámetros

  • expand, permite expandir instancias y colecciones.

Ejemplos

  • GET /v1/products/150.json?expand=[product_type]

Respuesta

{
  "href": "https://api.bsale.cl/v1/products/150.json",
  "id": 150,
  "name": "polera",
  "description": "",
  "classification": 0,
  "ledgerAccount": "",
  "costCenter": "",
  "allowDecimal": 0,
  "stockControl": 1,
  "printDetailPack": 0,
  "state": 0,
  "prestashopProductId": 0,
  "presashopAttributeId": 0,
  "product_type": {
    "href": "https://api.bsale.cl/v1/product_types/1.json",
    "id": "1"
  },
  "product_taxes": {
    "href": "https://api.bsale.cl/v1/products/150/product_taxes.json"
  }
}

GET variantes de un producto

  • GET /v1/products/62/variants.json
{
  "href": "https://api.bsale.cl/v1/variants.json",
  "count": 3,
  "limit": 25,
  "offset": 0,
  "items": [
    {
      "href": "https://api.bsale.cl/v1/variants/500.json",
      "id": 500,
      "description": "gap",
      "unlimitedStock": 0,
      "allowNegativeStock": 0,
      "state": 0,
      "barCode": "1351176376",
      "code": "1351176376",
      "imagestionCenterCost": 0,
      "imagestionAccount": 0,
      "imagestionConceptCod": 0,
      "imagestionProyectCod": 0,
      "imagestionCategoryCod": 0,
      "imagestionProductId": 0,
      "serialNumber": 0,
      "prestashopCombinationId": 0,
      "prestashopValueId": 0,
      "product": {
        "href": "https://api.bsale.cl/v1/products/150.json",
        "id": "150"
      },
      "attribute_values": {
        "href": "https://api.bsale.cl/v1/variants/500/attribute_values.json"
      },
      "costs": {
        "href": "https://api.bsale.cl/v1/variants/500/costs.json"
      }
    },
    {
      "href": "https://api.bsale.cl/v1/variants/499.json",
      "id": 499,
      "description": "L",
      "unlimitedStock": 0,
      "allowNegativeStock": 0,
      "state": 0,
      "barCode": "1351176361",
      "code": "1351176361",
      "imagestionCenterCost": 0,
      "imagestionAccount": 0,
      "imagestionConceptCod": 0,
      "imagestionProyectCod": 0,
      "imagestionCategoryCod": 0,
      "imagestionProductId": 0,
      "serialNumber": 0,
      "prestashopCombinationId": 0,
      "prestashopValueId": 0,
      "product": {
        "href": "https://api.bsale.cl/v1/products/150.json",
        "id": "150"
      },
      "attribute_values": {
        "href": "https://api.bsale.cl/v1/variants/499/attribute_values.json"
      },
      "costs": {
        "href": "https://api.bsale.cl/v1/variants/499/costs.json"
      }
    },
    {
      "href": "https://api.bsale.cl/v1/variants/498.json",
      "id": 498,
      "description": "verde",
      "unlimitedStock": 0,
      "allowNegativeStock": 0,
      "state": 0,
      "barCode": "1351176256",
      "code": "1351176256",
      "imagestionCenterCost": 0,
      "imagestionAccount": 0,
      "imagestionConceptCod": 0,
      "imagestionProyectCod": 0,
      "imagestionCategoryCod": 0,
      "imagestionProductId": 0,
      "serialNumber": 0,
      "prestashopCombinationId": 0,
      "prestashopValueId": 0,
      "product": {
        "href": "https://api.bsale.cl/v1/products/150.json",
        "id": "150"
      },
      "attribute_values": {
        "href": "https://api.bsale.cl/v1/variants/498/attribute_values.json"
      },
      "costs": {
        "href": "https://api.bsale.cl/v1/variants/498/costs.json"
      }
    }
  ]
}

GET impuestos de un producto

  • GET /v1/products/150/product_taxes.json
{
  "href": "https://api.bsale.cl/v1/products/150/product_taxes.json",
  "count": 2,
  "limit": 25,
  "offset": 0,
  "items": [
    {
      "href": "https://api.bsale.cl/v1/products/150/product_taxes/159.json",
      "id": "159",
      "tax": {
        "href": "https://api.bsale.cl/v1/taxes/1.json",
        "id": "1"
      }
    }
  ]
}

GET impuesto específico de un producto

  • GET /v1/products/150/product_taxes/159.json
{
  "href": "https://api.bsale.cl/v1/products/150/product_taxes/159.json",
    "id": "159",
    "tax": {
        "href": "https://api.bsale.cl/v1/taxes/1.json",
        "id": "1"
    }
}

GET cantidad de productos

  • GET /v1/products/count.json

Parámetros

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

Respuesta

{
  "count": 53
}

POST un producto

  • POST /v1/products.json

Se debe enviar un Json con la siguiente estructura.

{
  "name": "Calcetines",
  "description": "Multiples colores de calcetines",
  "allowDecimal": 0,
  "ledgerAccount": "Calcetas",
  "costCenter": "23",
  "stockControl": 1,
  "productTypeId": 1
}

Respuesta

{
  "stockControl": 1,
  "name": "Calcetines",
  "ledgerAccount": "Calcetas",
  "href": "https://api.bsale.cl/v1/products/97.json",
  "prestashopProductId": 0,
  "presashopAttributeId": 0,
  "costCenter": "23",
  "printDetailPack": 0,
  "product_type": {
    "href": "https://api.bsale.cl/v1/product_types/1.json",
    "id": "1"
  },
  "classification": 1,
  "description": "Multiples colores de calcetines",
  "id": 97,
  "state": 0,
  "allowDecimal": 0
}

PUT un producto

  • PUT /v1/products/67.json

Se debe enviar un Json con la siguiente esctructura.

{
  "id":"97",
  "name": "Calcetines de Mujer",
}

Respuesta

{
  "stockControl": 1,
  "name": "Calcetines de Mujer",
  "ledgerAccount": "Calcetas",
  "href": "https://api.bsale.cl/v1/products/97.json",
  "prestashopProductId": 0,
  "presashopAttributeId": 0,
  "costCenter": "23",
  "printDetailPack": 0,
  "product_type": {
    "href": "https://api.bsale.cl/v1/product_types/1.json",
    "id": "1"
  },
  "classification": 1,
  "description": "Multiples colores de calcetines",
  "id": 97,
  "state": 0,
  "allowDecimal": 0
}

DELETE un producto virtualmente

  • DELETE /v1/products/97.json cambia el estado del producto.
{
  "href": "https://api.bsale.cl/v1/products/97.json",
  "id": 97,
  "name": "Calcetines",
  "description": "Multiples colores de calcetines",
  "classification": 1,
  "ledgerAccount": "Calcetas",
  "costCenter": "23",
  "allowDecimal": 0,
  "stockControl": 1,
  "printDetailPack": 0,
  "state": 1,
  "prestashopProductId": 0,
  "presashopAttributeId": 0,
  "product_type": {
    "href": "https://api.bsale.cl/v1/product_types/1.json",
    "id": "1"
  }
}