Introduction

What is an API?

The term API is an abbreviation for Application Programming Interfaces. It is a set of definitions and protocols used to develop and integrate software.

What is this API for?

This API makes it easier for us to provide information and collect data from The Planet Seeds customers, in an automated manner.

We provide methods to obtain catalog data, stock, units of measure, prices and addresses.

In addition, we give the possibility of modifying data, such as addresses, order recordings or budgets.

How do I start?

Here is our base URL

https://api.theplanetseeds.com/api

Authentication

We use API keys to authenticate requests.

You can see, edit and delete your API keys in your user account, in the developer section.

Your API keys allow access to a lot of your sensitive information, so make sure you keep them very secure. Do not expose them in public areas like GitHub or through unsecure requests.

API authentication is performed through the HTTP Authorization header via Bearer token, using the access token obtained by executing the /login method with your API Key.

Remember: all requests must be made over HTTPS. If they are done over HTTP, they will fail.

Do you need help with your API Key?

Generate an API key in your user profile

The authentication header should look like the one in this example:

"Authorization: 
    Bearer yJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

Errors

We use conventional HTTP response codes to indicate the success or failure of an API request.

The codes of the 2xx range indicate the correct operation of the call.

The codes of the 4xx range represent errors in the calls made (due to missing fields, incorrect information, unauthenticated user, etc.).

The codes of the 5xx range represent an error in the JSON syntax of the call, or in very rare cases, a connection error with The Planet Seeds servers.

In case of getting 5xx server errors, you can contact it@theplanetseeds.com by sending the call made and the content sent, so that we can review the problem and find a solution if possible.

Summary of error codes

200 - OK. Everything works as expected.

204 - OK. Everything worked fine, but the call should not return any content.

400 - Error. Error processing the call. The specific error is returned as a response.

401 - Not authorized. Failed to perform successful pre-connection authentication.

403 - Forbidden. The api key does not have permissions to make the call.

500 - Server error. Something went wrong, malformed JSON or server connection error (rare).

Login

It makes an authentication request, the API key is verified, and if it is correct, it returns the token to be used in the rest of the methods.

The generated token has an expiration of 24 hours.

Endpoint:

POST /login

Method for log in

Here we show you an example call to perform the 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 Prestashop Catalog

Returns the complete list of articles prepared for data import in Prestashop platforms.


Endpoint:

GET /product/getCsvPrestashop

Get catalog response

Here is an example of the correct answer obtained:

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

Method to obtain the catalog adapted to Prestashop

Here is an example call to get the catalog:

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 Woocommerce Catalog

Returns the complete list of articles prepared for data import in Woocommerce platforms.


Endpoint:

GET /product/getCsvWoocommerce

Get catalog response

Here is an example of the correct answer obtained:

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

Method to obtain the catalog adapted to Woocommerce

Here is an example call to get the catalog:

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 CSV Catalog

Returns the complete list of articles ready for import in CSV format.


Endpoint:

GET /product/getCsv

Get catalog response

Here is an example of the correct answer obtained:

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

Method to obtain the catalog in CSV format

Here is an example call to get the catalog:

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 Category

Returns the complete product category tree in the same order as on the The Planet Seeds website.

The father: null attribute defines the parent category of the tree, while the rest have the immediately superior category.


Endpoint:

GET /product/getCategory

Correct answer of obtaining the categories

Here is an example of the correct answer obtained:

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

Method to obtain the categories of The Planet Seeds

Here is an example call to get the category tree:

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

Obtains the stock of available products.


Endpoint:

GET /product/getStock

Correct answer of obtaining product stock

Here is an example of the correct answer obtained:

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

Method to obtain the stock of the product

GetStock example call:

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 Price

You get the full price list from the client. These prices include the applied discount. In addition, the PVP price of the product is sent.


Endpoint:

GET /product/getPrice

Correct answer of obtaining price of the product

Here is an example of the correct answer obtained:

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

Method to obtain the price of the product

GetPrice example call:

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 New Order

Submit a new order or quote. Dropshipping and direct orders are allowed.


Endpoint:

POST /order/newOrder

Example object

{
    "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
        }
    ]
}

Correct answer obtained

Order successfully grabbed

Method to create a new order

CreateNewOrder example call:

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 Shipping Address

Gets the shipping addresses registered in the user account.


Endpoint:

GET /customer/getShippingAddress

Correct answer obtained

[
    {
        "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"
    }
]

Method to obtain the shipping address(es)

GetShippingAddress example call:

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 Shipping Address

Creates a new shipping address with the call data.


Endpoint:

POST /customer/createShippingAddress

Example object

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}

Correct answer obtained

Address 'Madrid Shop 2' created successfully.

Method to create a new shipping address

CreateShippingAddress example call:

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 Shipping Address

Updates the details of an existing shipping address. Only the «address» field and the fields to be updated are mandatory.


Endpoint:

PATCH /customer/updateShippingAddress

Correct answer obtained

Address 'Madrid Shop 2' updated successfully.

Method to update the data of your shipping addresses

UpdateShippingAddress example call:

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 Shipping Address

Removes the shipping address specified in the call. The address must be exact.


Endpoint:

DELETE /customer/deleteShippingAddress

Example object

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

Correct answer obtained

Address 'Madrid Tienda 2' deleted successfully.

Method to remove a shipping address

DeleteShippingAddress example call:

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 Billing Address

Gets the billing addresses registered in the user account.


Endpoint:

GET /customer/getBillingAddress

Correct answer obtained

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

Method to obtain the billing address(es)

GetBillingAddress example call:

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});

Method Collection

To facilitate the use of all these methods we have created a collection for Postman.

You only have to import this file, follow the authentication and login methods and you will have all the necessary data to make requests to our API.