Introducción

¿Qué es una API?

El término API es una abreviatura de Application Programming Interfaces, que en español significa interfaz de programación de aplicaciones. Se trata de un conjunto de definiciones y protocolos que se usan para desarrollar e integrar software.

¿Para qué sirve esta API?

Esta API nos facilita el suministro de información y recogida de datos de los clientes de The Planet Seeds, de manera automatizada.

Proporcionamos métodos para obtener datos de catálogo, stock, unidades de medida, precios y direcciones.

Además, damos la posibilidad de modificar datos, cómo direcciones, grabaciones de pedidos o presupuestos.

¿Cómo empiezo?

Aquí tienes nuestra URL de base

https://api.theplanetseeds.com/api

Autenticación

Utilizamos API keys para autenticar las peticiones.

Puedes ver, editar, y borrar tus API keys en tu cuenta de usuario, en la sección para desarrolladores.

Tu claves API permiten acceso a mucha de tu información sensible, así que asegúrate de mantenerlas muy seguras. No las expongas en áreas públicas como GitHub o a través de peticiones no seguras.

La autenticación de la API se realiza mediante la cabecera HTTP Authorization vía Bearer token, usando como token de acceso, el obtenido al ejecutar el metodo /login con tu API Key.

Recuerda: Todas las peticiones deben realizarse sobre HTTPS. Si se realizan sobre HTTP, fallarán.

¿Necesitas ayuda con tu API Key?

Genera una API key en tu perfil de usuario

La cabecera de autenticación debería verse cómo la de este ejemplo:

"Authorization: 
    Bearer yJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

Errores

Utilizamos códigos de respuesta convencionales de HTTP, para indicar el éxito o fracaso de una solicitud API.

Los códigos del rango 2xx indican el correcto funcionamiento de la llamada.

Los códigos del rango 4xx representan errores en las llamadas realizadas (por falta de campos, información incorrecta, usuario no autenticado, etc.).

Los códigos del rango 5xx representan un error en la sintaxis JSON de la llamada, o en casos muy poco frecuentes, un error de conexión con los servidores de The Planet Seeds.

En caso de obtener errores 5xx de servidor, puedes contactar con it@theplanetseeds.com enviando la llamada realizada y el contenido enviado, para que podamos revisar el problema y en buscar una solución en caso de ser posible.

Resumen de códigos de error

200 - OK. Todo funciona de la manera esperada.

204 - OK. Todo funcionó correctamente, pero la llamada no debe devolver ningún contenido.

400 - Error. Error al procesar la llamada. Se devuelve el error concreto como respuesta.

401 - No autorizado. No se ha realizado una autenticación correcta previa a la conexión.

403 - Prohibido. La api key no dispone de permisos para realizar la llamada.

500 - Error de servidor. Algo salió mal, JSON malformado o error de conexión con el servidor (poco frecuente)

Login

Realiza una petición de autenticación, se verifica la API key, y en caso de ser correcta, devuelve el token que se ha de usar en el resto de métodos.

El token generado tiene una caducidad de 24h.

Endpoint:

POST /login

Método para log in

Aquí os mostramos una llamada de ejemplo para realizar el log in:

1var axios = require('axios');
2var data = JSON.stringify({"apiKey":"$2b$12$zni4xlVH0qqhHS0/QlJ9R.YHOLESSG8/XhzgoyatDnaBJrncNlVN"});
3 
4var config = {
5  method: 'post',
6  url: 'https://api.theplanetseeds.com/api/login',
7  headers: { 
8    'Content-Type': 'application/json'
9  },
10  data : data
11};
12 
13axios(config)
14.then(function (response) {
15  console.log(JSON.stringify(response.data));
16})
17.catch(function (error) {
18  console.log(error);
19});
20

Get Catálogo

Devuelve la lista completa de artículos con referencias, imágenes, descripciones, etc.


Endpoint:

GET /product/getCatalogo

Respuesta obtención catálogo

A continuación, te mostramos un ejemplo de respuesta correcta obtenida:

[
   {
        "itemCode": "ACES0001",
        "productName": "Ace Seeds Orient Express Fem",
        "category": 3293,
        "shortDescription": "<p>Genetics: 60% sativa / 40% indica. Vietnam Black sativa x China Yunnan indica.<br /> Indoor and outdoor cultivation.<br /> Indoor flowering: 8-10 weeks<br /> Flowering outdoors: First fortnight of October<br /> Production: High<br /> Medium resistance to spiders and medium-high to powdery mildew and botrytis<br /> Good adaptation to cold.</p>",
        "description": "<p>Orient Express is a feminized variety of marijuana seed from the ACE SEEDS seed bank. A Sativa / Indica hybrid of abundant production, short flowering and a warm and sociable effect.</p><p> Orient Express is a plant that has a compact structure and very good branching. Its organic and composted aroma transports you to a humid forest. It has a dense earthy flavor with floral touches.</p><p> Orient Express offers a clean and pleasant sativa high without paranoia. Perfect for conversation and enjoyment.</p>",
        "tecnicalDetails": "",
        "manufacturer": "Ace Seeds",
        "variationGroup": 12,
        "ratio": null,
        "tipo": "fem",
        "variations": [
            {
                "idGroup": 1,
                "group": "Quantity",
                "idAttribute": 18,
                "attribute": "5 Units"
            }
        ],
        "images": [
            "https://api.theplanetseeds.com/p/ACES0001/ACES0001-00.png"
        ]
    },
    {
        "itemCode": "ACES0028",
        "productName": "Ace Seeds Bubba Hash Fem",
        "category": 3293,
        "shortDescription": "<div>Suitable for<span style=\"white-space:pre\"> </span>Indoor and outdoor</div><div> Sex <span style=\"white-space: pre;\">:</span> Feminized</div><div> Genotype <span style=\"white-space: pre;\">:</span> 90% Indica and 10% Sativa</div><div> Genetics <span style=\"white-space: pre;\">:</span> Bubba Kush (Katsu) x HashPlant 90┤s</div><div> Indoor flowering <span style=\"white-space:pre\">:</span> 8 - 9 weeks</div><div> Flowering outdoors<span style=\"white-space:pre\"> </span>end of september</div><div> THC<span style=\"white-space:pre\"> </span>15-18% a</div>",
        "description": "<div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Red spider resistance<span style=\"font-size: 13px; white-space: pre;\"> </span>High average </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Resistance to powdery mildew<span style=\"font-size: 13px; white-space: pre;\"> </span>High average </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Botrytis resistance<span style=\"font-size: 13px; white-space: pre;\"> </span>High average </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Whitefly resistance<span style=\"font-size: 13px; white-space: pre;\"> </span>High average </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Cold resistance<span style=\"font-size: 13px; white-space: pre;\"> </span>high </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Heat resistance<span style=\"font-size: 13px; white-space: pre;\"> </span>high </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Latitude<span style=\"font-size: 13px; white-space: pre;\"> </span>0║-47║ </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Genetics<span style=\"font-size: 13px; white-space: pre;\"> </span>Pakistan Chitral Kush purple x Orient Express (feno hashplant China Yunnan). </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"></div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Structure<span style=\"font-size: 13px; white-space: pre;\"> </span>Compact, robust structure of practically pure indica. Large, thick and dark leaves. Generally short internodal distance. Excellent branching in certain specimens. </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Bouquet<span style=\"font-size: 13px; white-space: pre;\"> </span>Humid earth, humid forest, hashish, fruits of the forest (mainly blackberry). </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Effect<span style=\"font-size: 13px; white-space: pre;\"> </span>Pleasant and expansive effect, which leaves you floating warmly in a bath of pleasant sensations. </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> Advice<span style=\"font-size: 13px; white-space: pre;\"> </span>Indoors it can be grown very easily. Outdoors it can be grown up to latitude 47║. </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"></div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> It requires medium-high nutrient levels throughout its development. </div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"></div><div style=\"font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-family: rockwellregular, sans-serif; font-size: 13px;\"> The highest and most productive phenos may take 9 weeks to reach their peak of maturity, but most plants finish in as little as 7-8 weeks.</div><p></p><p> Snow Moon is a vigorous and flavorful &#39;hashplant&#39; hybrid with indica genetics from Pakistan and China.</p><p> It combines 2 excellent elite hash plants from our genetic library: the famous purple Pakistan Chitral Kush 2002 and our best parent of the indica phenotype from China Yunnan, from our hybrid Orient Express.</p><p> Snow Moon has 2 main phenotypes that are equally frequent.<br /> On the one hand we have the &#39;white&#39; pheno, with a greater influence of the hashish plant from China Yunnan, more organic, earthy and humid forest aromas. This phenomenon matures producing a thick and resplendent layer of resin on the nearby flowers and leaves, which gives it that snowy appearance reminding us of the best expressions of the white family of the 90s.</p><p> On the other hand we have the &#39;blackberry&#39; pheno, of evident Pakistani influence, which produces flowers of beautiful purple colors and reddish tones, giving off a sticky and sweet resin with aromas of forest fruit gum when ripe.</p><p> Both phenomena produce Indica plants of remarkable quality, with a warm, pleasant and happy psychoactivity, always deep and sweet aromas. The hash from this variety is exceptional.</p><p> Since 2007 we have been experimenting with different combinations of Pakistan Chitral and China Yunnan, until we find the best possible combinations between these 2 classic indicas in our catalog. Snow Moon was born in 2013 and since then we have been conducting tests to finally offer you this limited edition in 2016.</p><p> Available in both formats (standard and feminized) as long as there is stock.</p>",
        "tecnicalDetails": "",
        "manufacturer": "Ace Seeds",
        "variationGroup": 16,
        "ratio": null,
        "tipo": "fem",
        "variations": [
            {
                "idGroup": 1,
                "group": "Quantity",
                "idAttribute": 18,
                "attribute": "5 Units"
            }
        ],
        "images": [
            "https://api.theplanetseeds.com/p/ACES0028/ACES0028-00.png"
        ]
    }
]

Método para obtener el catálogo

Aquí os mostramos una llamada de ejemplo para obtener el catálogo:

1var axios = require('axios');
2 
3var config = {
4  method: 'get',
5  url: 'https://api.theplanetseeds.com/api/product/getAllProducts',
6  headers: { 
7    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQyNTQzODMsImV4cCI6MTYxNDM0MDc4M30.kDXELgGovdtnpUri5MeaCKZQqT7ba_q_LY7VZ3eurWQ'
8  }
9};
10 
11axios(config)
12.then(function (response) {
13  console.log(JSON.stringify(response.data));
14})
15.catch(function (error) {
16  console.log(error);
17});

Get Catálogo Prestashop

Devuelve la lista completa de artículos con preparados para la importación de datos en las plataformas Prestashop.


Endpoint:

GET /product/getCsvPrestashop

Respuesta obtención catálogo

A continuación, te mostramos un ejemplo de respuesta correcta obtenida:

REFERENCE;PRODUCT;BRAND;TAX;WEIGHT;STOCK;SHORT_DESCRIPTION;DESCRIPTION;IMAGES;CATEGORY_PATH;ID_CATEGORY_PATH;PRICE_CLIENTE;PVP;WIDTH;HEIGHT;DEPTH;ID_CATEGORY_DEFAULT;REFERENCE_PARENT;ATTR;ATTR2;RATIO;TYPE;
ADSE0002;"Advanced Seeds Auto Top 69";;21;0;99999;"Top 69 pertenece a una nueva generación de plantas autoflorecientes, fruto de cruces selectivos que la dotan de gran estabilidad genética y una producción abundante, dando respuesta a los cultivadores que demandaban variedades autoflorecientes más productivas.<br />Tope de producción en 69 días. Ideal para cultivo interior y exterior.<br />Gran estabilidad genética.<br />En climas frios cultivar solo en verano.";"Genética: Autoflowering<br />Rendimiento: 350 - 450 g/m2<br />THC: 14%<br />Altura interior: 60 - 100 cm<br />Altura Exterior: 60 - 120 cm<br />Floracion Interior: 69 días (max.)<br />Cosecha Exterior: De Abril a Noviembre";https://api.theplanetseeds.com/p/ADSE0002/ADSE0002-00.png;Autoflorecientes > Advanced Seeds Auto;3279 > 3294;10.59;19.42;0;0;0;3294;ADSE0001;3;;auto
ADSE0003;"Advanced Seeds Critical Fem.";;21;0;99999;"<p>Planta grande y ramificada con gran producción de cogollos. Se adapta a todo tipo de sustratos y formas de cultivo.  En interior se aconseja dar un máximo de 15 días de crecimiento para evitar un tamaño final demasiado grande. La  cosecha en exterior es generosa y rápida. El uso de tutores es imprescindible en algunos casos para que las ramas no  se doblen al final de la floración por su propio peso.</p>";"<p><strong>Ficha Técnica</strong></p><ul>  <li><strong>Tipo de variedad:</strong> Critical</li>  <li><strong>THC:</strong> 16 %</li>  <li><strong>Rendimiento:</strong> 450 - 500 G</li>  <li><strong>Altura Interior:</strong> 70 - 90 cm</li>  <li><strong>Altura Exterior:</strong> 200 - 300 cm</li>  <li><strong>Ciclo de floración:</strong> 45 - 55 días</li>  <li><strong>Cosecha:</strong> 1 - 15 Octubre</li></ul>";https://api.theplanetseeds.com/p/ADSE0003/ADSE0003-00.png;Feminizadas > Advanced Seeds Fem;3281 > 3299;7.88;14.46;0;0;0;3299;;3;;fem

Método para obtener el catálogo adaptado a Prestashop

Aquí os mostramos una llamada de ejemplo para obtener el catálogo:

1var axios = require('axios');
2var data = JSON.stringify({"lang":1});
3 
4var config = {
5  method: 'get',
6  url: 'https://api.theplanetseeds.com/api/producto/getCsvPrestashop',
7  headers: { 
8    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQyNTQzODMsImV4cCI6MTYxNDM0MDc4M30.kDXELgGovdtnpUri5MeaCKZQqT7ba_q_LY7VZ3eurWQ'
9  },
10  data : data
11};
12 
13axios(config)
14.then(function (response) {
15  console.log(JSON.stringify(response.data));
16})
17.catch(function (error) {
18  console.log(error);
19});

Get Catálogo Woocommerce

Devuelve la lista completa de artículos con preparados para la importación de datos en las plataformas Woocommerce.


Endpoint:

GET /product/getCsvWoocommerce

Respuesta obtención catálogo

A continuación, te mostramos un ejemplo de respuesta correcta obtenida:

Tipo;SKU;Nombre;Publicado;"¿Está destacado?";"Visibilidad en el catálogo";"Descripción corta";Descripción;"Día en que empieza el precio rebajado";"Día en que termina el precio rebajado";"Estado del impuesto";"Clase de impuesto";"¿En inventario?";Inventario;"Cantidad de bajo inventario";"¿Permitir reservas de productos agotados?";"¿Vendido individualmente?";"Peso (kg)";"Longitud (cm)";"Anchura (cm)";"Altura (cm)";"¿Permitir valoraciones de clientes?";"Nota de compra";"Precio rebajado";"Precio normal";Categorías;Etiquetas;"Clase de envío";Imágenes;"Límite de descargas";"Días de caducidad de la descarga";Superior;"Productos agrupados";"Ventas dirigidas";"Ventas cruzadas";URL externa";"Texto del botón";Posición;meta:Brand;"Nombre del atributo 1";"Valor(es) del atributo 1";"Atributo visible 1";"Atributo global 1";"Nombre del atributo 2";"Valor(es) del atributo 2";"Atributo visible 2";"Atributo global 2";"Nombre del atributo 3";"Valor(es) del atributo 3";"Atributo visible 3";"Atributo global 3";"Nombre del atributo 4";"Valor(es) del atributo 4";"Atributo visible 4";"Atributo global 4";"Nombre del atributo 5";"Valor(es) del atributo 5";"Atributo visible 5";RATIO;TYPE;
simple;ADSE0002;"Advanced Seeds Auto Top 69";1;0;visible;"Top 69 pertenece a una nueva generación de plantas autoflorecientes, fruto de cruces selectivos que la dotan de gran estabilidad genética y una producción abundante, dando respuesta a los cultivadores que demandaban variedades autoflorecientes más productivas.<br />Tope de producción en 69 días. Ideal para cultivo interior y exterior.<br />Gran estabilidad genética.<br />En climas frios cultivar solo en verano.";"Genética: Autoflowering<br />Rendimiento: 350 - 450 g/m2<br />THC: 14%<br />Altura interior: 60 - 100 cm<br />Altura Exterior: 60 - 120 cm<br />Floracion Interior: 69 días (max.)<br />Cosecha Exterior: De Abril a Noviembre";0;0;taxable;;1;99999;;0;0;0;0;0;0;1;;;10.59;Autoflorecientes > Advanced Seeds Auto;;;https://api.theplanetseeds.com/p/ADSE0002/ADSE0002-00.png;;;;;;;;;;;3 Unidades;3;1;;;auto
simple;ADSE0003;"Advanced Seeds Critical Fem.";1;0;visible;"<p>Planta grande y ramificada con gran producción de cogollos. Se adapta a todo tipo de sustratos y formas de cultivo.  En interior se aconseja dar un máximo de 15 días de crecimiento para evitar un tamaño final demasiado grande. La  cosecha en exterior es generosa y rápida. El uso de tutores es imprescindible en algunos casos para que las ramas no  se doblen al final de la floración por su propio peso.</p>";"<p><strong>Ficha Técnica</strong></p><ul>  <li><strong>Tipo de variedad:</strong> Critical</li>  <li><strong>THC:</strong> 16 %</li>  <li><strong>Rendimiento:</strong> 450 - 500 G</li>  <li><strong>Altura Interior:</strong> 70 - 90 cm</li>  <li><strong>Altura Exterior:</strong> 200 - 300 cm</li>  <li><strong>Ciclo de floración:</strong> 45 - 55 días</li>  <li><strong>Cosecha:</strong> 1 - 15 Octubre</li></ul>";0;0;taxable;;1;99999;;0;0;0;0;0;0;1;;;7.88;Feminizadas > Advanced Seeds Fem;;;https://api.theplanetseeds.com/p/ADSE0003/ADSE0003-00.png;;;;;;;;;;;3 Unidades;3;1;;;fem

Método para obtener el catálogo adaptado a Woocommerce

Aquí os mostramos una llamada de ejemplo para obtener el catálogo:

1var axios = require('axios');
2var data = JSON.stringify({"lang":1});
3 
4var config = {
5  method: 'get',
6  url: 'https://api.theplanetseeds.com/api/product/getCsvWoocommerce',
7  headers: { 
8    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQyNTQzODMsImV4cCI6MTYxNDM0MDc4M30.kDXELgGovdtnpUri5MeaCKZQqT7ba_q_LY7VZ3eurWQ'
9  },
10  data : data
11};
12 
13axios(config)
14.then(function (response) {
15  console.log(JSON.stringify(response.data));
16})
17.catch(function (error) {
18  console.log(error);
19});

Get Catálogo CSV

Devuelve la lista completa de artículos con preparados para la importación en formato CSV.


Endpoint:

GET /product/getCsv

Respuesta obtención catálogo

A continuación, te mostramos un ejemplo de respuesta correcta obtenida:

REFERENCE;PRODUCT;BRAND;TAX;STOCK;SHORT_DESCRIPTION;DESCRIPTION;IMAGES;CATEGORY_PATH;ID_CATEGORY_PATH;BASE_PRICE;PVP;WEIGHT;WIDTH;HEIGHT;DEPTH;ID_CATEGORY_DEFAULT;REFERENCE_PARENT;ATTR;ATTR2;TIPO;RATIO
ADSE0002;"Advanced Seeds Auto Top 69";;21;99999;"Top 69 pertenece a una nueva generación de plantas autoflorecientes, fruto de cruces selectivos que la dotan de gran estabilidad genética y una producción abundante, dando respuesta a los cultivadores que demandaban variedades autoflorecientes más productivas.<br />Tope de producción en 69 días. Ideal para cultivo interior y exterior.<br />Gran estabilidad genética.<br />En climas frios cultivar solo en verano.";"Genética: Autoflowering<br />Rendimiento: 350 - 450 g/m2<br />THC: 14%<br />Altura interior: 60 - 100 cm<br />Altura Exterior: 60 - 120 cm<br />Floracion Interior: 69 días (max.)<br />Cosecha Exterior: De Abril a Noviembre";https://api.theplanetseeds.com/p/ADSE0002/ADSE0002-00.png;Autoflorecientes > Advanced Seeds Auto;3279 > 3294;10.59;19.42;0;0;0;0;3294;ADSE0001;3;;auto
ADSE0003;"Advanced Seeds Critical Fem.";;21;99999;"<p>Planta grande y ramificada con gran producción de cogollos. Se adapta a todo tipo de sustratos y formas de cultivo.  En interior se aconseja dar un máximo de 15 días de crecimiento para evitar un tamaño final demasiado grande. La  cosecha en exterior es generosa y rápida. El uso de tutores es imprescindible en algunos casos para que las ramas no  se doblen al final de la floración por su propio peso.</p>";"<p><strong>Ficha Técnica</strong></p><ul>  <li><strong>Tipo de variedad:</strong> Critical</li>  <li><strong>THC:</strong> 16 %</li>  <li><strong>Rendimiento:</strong> 450 - 500 G</li>  <li><strong>Altura Interior:</strong> 70 - 90 cm</li>  <li><strong>Altura Exterior:</strong> 200 - 300 cm</li>  <li><strong>Ciclo de floración:</strong> 45 - 55 días</li>  <li><strong>Cosecha:</strong> 1 - 15 Octubre</li></ul>";https://api.theplanetseeds.com/p/ADSE0003/ADSE0003-00.png;Feminizadas > Advanced Seeds Fem;3281 > 3299;7.88;14.46;0;0;0;0;3299;;3;;fem

Método para obtener el catálogo en formato CSV

Aquí os mostramos una llamada de ejemplo para obtener el catálogo:

1var axios = require('axios');
2var data = JSON.stringify({"lang":1});
3 
4var config = {
5  method: 'get',
6  url: 'https://api.theplanetseeds.com/api/product/getCsv',
7  headers: { 
8    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQyNTQzODMsImV4cCI6MTYxNDM0MDc4M30.kDXELgGovdtnpUri5MeaCKZQqT7ba_q_LY7VZ3eurWQ'
9  },
10  data : data
11};
12 
13axios(config)
14.then(function (response) {
15  console.log(JSON.stringify(response.data));
16})
17.catch(function (error) {
18  console.log(error);
19});

Get Categoria

Devuelve el árbol completo de categorías de los productos con el mismo orden que en el website de The Planet Seeds.

El atributo father: null, define la categoría padre del árbol, mientras que el resto, dispone de la categoría inmediatamente superior.


Endpoint:

GET /product/getCategory

Respuesta correcta de obtención de las categorías

A continuación, te mostramos un ejemplo de respuesta correcta obtenida:

[
    {
        "id": 2324,
        "father": 1,
        "name": "Semillas",
        "position": null
    },
    {
        "id": 3279,
        "father": 2324,
        "name": "Autoflorecientes",
        "position": null
    },
    {
        "id": 3281,
        "father": 2324,
        "name": "Feminizadas",
        "position": null
    }
]

Método para obtener las categorías de The Planet Seeds

Aquí os mostramos una llamada de ejemplo para obtener el árbol de categorías:

1var axios = require('axios');
2var data = JSON.stringify({"lang":1});
3 
4var config = {
5  method: 'get',
6  url: 'https://api.theplanetseeds.com/api/product/getCategory',
7  headers: { 
8    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTUxOTQ0MzQsImV4cCI6MTYxNTI4MDgzNH0.4SCvWNwD-nzP033a1Rt95uoWlmQkOfpj0hAqB01yMwI', 
9    'Content-Type': 'application/json'
10  },
11  data : data
12};
13 
14axios(config)
15.then(function (response) {
16  console.log(JSON.stringify(response.data));
17})
18.catch(function (error) {
19  console.log(error);
20});
21
22

Get Stock

Obtiene el Stock de productos disponibles.


Endpoint:

GET /product/getStock

Respuesta correcta de obtención de stock del producto

A continuación, te mostramos un ejemplo de respuesta correcta obtenida:

[
    {
        "itemCode": "ACES0001",
        "stock": 99999
    },
    {
        "itemCode": "ACES0028",
        "stock": 99999
    },
    {
        "itemCode": "ADSE0002",
        "stock": 99999
    },
    {
        "itemCode": "ADSE0003",
        "stock": 99999
    }
]

Método para obtener el stock del producto

Llamada de ejemplo getStock:

1var axios = require('axios');
2    
3var config = {
4  method: 'get',
5  url: 'https://api.theplanetseeds.com/api/product/getStock',
6  headers: { 
7    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMjIyNSIsImdyb3VwQ29kZSI6MTA2LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQ5NTE4ODgsImV4cCI6MTYxNTAzODI4OH0.bWL_rLE4mmW9Aq2DmVl50LIKu7VisPgHeY5K_n9_GtI'
8  }
9};
10
11axios(config)
12.then(function (response) {
13  console.log(JSON.stringify(response.data));
14})
15.catch(function (error) {
16  console.log(error);
17});

Get Precio

Obtiene la tarifa completa de precios del cliente. Estos precios incluyen el descuento aplicado. Además se envía el precio PVP del producto.


Endpoint:

GET /product/getPrice

Respuesta correcta de obtención de precio del producto

A continuación, te mostramos un ejemplo de respuesta correcta obtenida:

[
    {
        "itemCode": "ACES0001",
        "price": 18.18,
        "pvp": 40
    },
    {
        "itemCode": "ACES0028",
        "price": 22.73,
        "pvp": 50
    }
]

Método para obtener el precio del producto

Llamada de ejemplo getPrecio:

1var axios = require('axios');
2 
3var config = {
4  method: 'get',
5  url: 'https://api.theplanetseeds.com/api/product/getPrice',
6  headers: { 
7    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTUxOTQ0MzQsImV4cCI6MTYxNTI4MDgzNH0.4SCvWNwD-nzP033a1Rt95uoWlmQkOfpj0hAqB01yMwI'
8  }
9};
10 
11axios(config)
12.then(function (response) {
13  console.log(JSON.stringify(response.data));
14})
15.catch(function (error) {
16  console.log(error);
17});

Create Nuevo Pedido

Envía un nuevo pedido o presupuesto. Se permiten pedidos directos y de dropshipping.


Endpoint:

POST /order/newOrder

Objeto de ejemplo

{
    "isQuote": "Y",
    "isDropship": "Y",
    "shipInstructions": "C/ Test 123 Madrid 28001 Madrid España",
    "shipAddress": "Tienda",
    "billAddress": "Tienda",
    "orderIntructions": "Do not send documentation",
    "remarks": "Order Comments",
    "items": [
        {
            "itemCode": "RIPP0009",
            "quantity": 10
        },
        {
            "itemCode": "SWEE0160",
            "quantity": 1
        }
    ]
}

Respuesta correcta Obtenida

Order successfully grabbed

Método para crear nuevo pedido

Llamada de ejemplo createNuevoPedido:

1var axios = require('axios');
2var data = JSON.stringify({"isQuote":"Y","isDropship":"Y","shipInstructions":"C/ Test 123 Montilla 14550 Córdoba España","shipAddress":"Tienda Córdoba","billAddress":"Tienda Córdoba","orderIntructions":"No enviar documentación","remarks":"Comentarios del pedido","items":[{"itemCode":"TONE0011","quantity":80},{"itemCode":"LUMI0017","quantity":5},{"itemCode":"SUST0110","quantity":2}]});
3 
4var config = {
5  method: 'post',
6  url: 'https://api.theplanetseeds.com/api/order/newOrder',
7  headers: { 
8    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTUxOTQ0MzQsImV4cCI6MTYxNTI4MDgzNH0.4SCvWNwD-nzP033a1Rt95uoWlmQkOfpj0hAqB01yMwI', 
9    'Content-Type': 'application/json'
10  },
11  data : data
12};
13 
14axios(config)
15.then(function (response) {
16  console.log(JSON.stringify(response.data));
17})
18.catch(function (error) {
19  console.log(error);
20});

Get Direccion Envio

Obtiene las direcciones de envío registradas en la cuenta del usuario.


Endpoint:

GET /customer/getShippingAddress

Respuesta correcta Obtenida

[
    {
        "address": "My address",
        "street": "123rd test street",
        "city": "Montilla",
        "zipCode": "28001",
        "state": "Madrid",
        "country": "Madrid",
        "contactPerson": "Manuel Fernández López.",
        "phone": "+34 6xx xx xx xx",
        "schedule": "From 10 a.m. to 2 p.m.",
        "remark": "Transport Remarks"
    }
]

Método para obtener la/s direccion/es de envío

Llamada de ejemplo getDireccionEnvio:

1var axios = require('axios');
2 
3var config = {
4  method: 'get',
5  url: 'https://api.theplanetseeds.com/api/customer/getShippingAddress',
6  headers: { 
7    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMjIyNSIsImdyb3VwQ29kZSI6MTI2LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQyNTUxMDIsImV4cCI6MTYxNDM0MTUwMn0.2MiXr-C-JOtyvn__o09MXCLlpe7EiUr3ZFPfSEMmUa8'
8  }
9};
10 
11axios(config)
12.then(function (response) {
13  console.log(JSON.stringify(response.data));
14})
15.catch(function (error) {
16  console.log(error);
17});

Create Direccion Envio

Crea una nueva dirección de envío con los datos de la llamada.


Endpoint:

POST /customer/createShippingAddress

Objeto de ejemplo

1{
2    "name": "Madrid Shop 2",
3    "street": "Sample Street 123",
4    "zipCode": "28001",
5    "city": "Madrid",
6    "state": "Madrid",
7    "country": "ES",
8    "contactPerson": "Antonio Gutiérrez",
9    "phone": "+34 6xx xx xx xx",
10    "phoneShipping": "+34 6xx xx xx xx",
11    "shippingRemarks": "Transport Remarks"
12}

Respuesta correcta Obtenida

Address 'Madrid Shop 2' created successfully.

Método para crear una nueva dirección de envío

Llamada de ejemplo createDireccionEnvio:

1var axios = require('axios');
2var data = JSON.stringify({
3    "name": "Madrid Shop 2",
4    "street": "Sample Street 123",
5    "zipCode": "28001",
6    "city": "Madrid",
7    "state": "Madrid",
8    "country": "ES",
9    "contactPerson": "Antonio Gutiérrez",
10    "phone": "+34 6xx xx xx xx",
11    "phoneShipping": "+34 6xx xx xx xx",
12    "shippingRemarks": "Transport Remarks"
13});
14 
15var config = {
16  method: 'post',
17  url: 'https://api.theplanetseeds.com/api/customer/createShippingAddress',
18  headers: { 
19    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQ5NDE5MDEsImV4cCI6MTYxNTAyODMwMX0.qesOvjyWZfQJF3TOYk4iHa4o0OYoqZElGXam_yyQWsk', 
20    'Content-Type': 'application/json'
21  },
22  data : data
23  };
24 
25axios(config)
26.then(function (response) {
27  console.log(JSON.stringify(response.data));
28})
29.catch(function (error) {
30  console.log(error);
31});
32

Update Direccion Envio

Actualiza los datos de una dirección de envío ya existente. Sólo es obligatorio el campo “address” y los campos a actualizar.


Endpoint:

PATCH /customer/updateShippingAddress

Respuesta correcta Obtenida

Address 'Madrid Shop 2' updated successfully.

Método para actualizar los datos de tus direcciones de envío

Llamada de ejemplo updateDireccionEnvio:

1var axios = require('axios');
2var data = JSON.stringify({"address":"My address","country":"ES","zipCode":"","phone":"+34 6xx xx xx xx","phoneShipping":"+34 6xx xx xx xx xx "});
3 
4var config = {
5  method: 'patch',
6  url: 'https://api.theplanetseeds.com/api/customer/updateShippingAddress',
7  headers: { 
8    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMjIyNSIsImdyb3VwQ29kZSI6MTA2LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQ5NTE4ODgsImV4cCI6MTYxNTAzODI4OH0.bWL_rLE4mmW9Aq2DmVl50LIKu7VisPgHeY5K_n9_GtI', 
9    'Content-Type': 'application/json'
10  },
11  data : data
12};
13 
14axios(config)
15.then(function (response) {
16  console.log(JSON.stringify(response.data));
17})
18.catch(function (error) {
19  console.log(error);
20});

Delete Direccion Envio

Elimina la dirección de envío especificada en la llamada. La dirección debe ser exacta.


Endpoint:

DELETE /customer/deleteShippingAddress

Objeto de ejemplo

1{
2    "address": "Madrid Tienda"
3}

Respuesta correcta obtenida

Address 'Madrid Tienda 2' deleted successfully.

Método para eliminar una dirección de envío

Llamada de ejemplo deleteDireccionEnvio:

1var axios = require('axios');
2var data = JSON.stringify({  "address": "Tienda Madrid" });
3 
4var config = {
5  method: 'delete',
6  url: 'https://api.theplanetseeds.com/api/customer/deleteShippingAddress',
7  headers: { 
8    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQ5NDE5MDEsImV4cCI6MTYxNTAyODMwMX0.qesOvjyWZfQJF3TOYk4iHa4o0OYoqZElGXam_yyQWsk', 
9    'Content-Type': 'application/json'
10  },
11  data : data
12};
13 
14axios(config)
15.then(function (response) {
16  console.log(JSON.stringify(response.data));
17})
18.catch(function (error) {
19  console.log(error);
20});

Get Direccion Facturacion

Obtiene las direcciones de facturación registradas en la cuenta del usuario.


Endpoint:

GET /customer/getBillingAddress

Respuesta correcta Obtenida

[
    {
        "address": "Madrid Address",
        "street": "Sample street 123",
        "city": "Madrid",
        "zipCode": "28001",
        "state": "Madrid",
        "country": "España"
    }
]

Método para obtener la/s direccion/es de facturación

Llamada de ejemplo getDireccionFacturacion:

1var axios = require('axios');
2 
3var config = {
4  method: 'get',
5  url: 'https://api.theplanetseeds.com/api/customer/getBillingAddress',
6  headers: { 
7    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjYXJkQ29kZSI6IkMwMDAxMCIsImdyb3VwQ29kZSI6MTI3LCJsaXN0TnVtIjoxMiwibm9EaXNjb3VudCI6Ik4iLCJkaXNjUmVsIjoiSCIsIm11ZXN0cmFPY3VsdGFzIjoxLCJpYXQiOjE2MTQ5NDE5MDEsImV4cCI6MTYxNTAyODMwMX0.qesOvjyWZfQJF3TOYk4iHa4o0OYoqZElGXam_yyQWsk'
8  }
9};
10 
11axios(config)
12.then(function (response) {
13  console.log(JSON.stringify(response.data));
14})
15.catch(function (error) {
16  console.log(error);
17});

Colección métodos

Para facilitar el uso de todos estos métodos hemos creado una colección para Postman.

Sólo tienes que importar este archivo, seguir los métodos de autenticación y login y ya dispondrás de todos los datos necesarios para realizar las peticiones a nuestra API.