Presiona ENTER para ver los resultados o ESC para cancelar.

Prisync Tutorial de API serie-2 toma de datos de producto

Bienvenido a la 2da de Prisync API Tutorial Series con el objetivo de clarificar los fundamentos de la API.

En el primer post, Especulado sobre:

  • que los problemas Prisync (y el API V2.0) resuelve en nombre de ustedes,
  • creación de la API key y token,
  • agregar tu primer producto via API V2.0,
  • agregar tu URL y un montón de direcciones URL del competidor,
  • and batch importing via the API.

PurposePrisync API Tutorial

En este post, I’ll go through gathering the data using Prisync API V2.0. Sin embargo, you can re-visit the first post of Prisync API Tutorial Series and API documentation.

Lo primero es lo primero, I’ll assume that you followed first post and you’ve already added a couple of products to your Prisync account. No worries if you don’t have any products. Just go back and complete the first tutorial or you can add products on your tablero de instrumentos. Además, we’ll need the make_request method that we used in the first post so that let me recap it below:

It’s a tiny method which calls the API endpoints, adding the authentication headers.

Listing the Products You Have

Prisync API V2.0 has /list/product (link to doc) punto final, which basically lists all products on your account.

All you need to do is making a request to the /list/product punto final:

The response is below:

Voilà! I got all the products (since I only have 4 de ellos) in just one request. results is a JSON array, returning list of products up to 100 items. When you have more than 100 productos, the result is paginated by 100. Therefore in every response, the API returns the next page’s URL so that you can iterate within a for loop.

Each item in the results list represents a single product. So each product contains:

  1. ID
  2. Name
  3. Category (both name and category ID)
  4. Brand (both name and brand ID)
  5. Product Code (SKU, EAN or any other internal product code)

Each product on your Prisync account has several URLs including your own URL and competitor URLs. Another step we reached, we now need to retrieve that URLs.

This is easy to do. What you need is calling the get a particular product (link to doc) punto final. Vamos a llamarlo para el “iPhone X, GSM desbloqueado 5.8 – 64 GB – Espacio gris“. Necesito el id de la misma y establece el /list/product solicitud respuesta:

“ID”: “2055805”
“nombre”: “iPhone X, GSM desbloqueado 5.8 – 64 GB – Espacio gris”,iPhone 8 gris espacial - Prisync API Tutorial

 

Conseguir el producto en Particular

Parece que estamos casi allí. Vamos a poner el ID en la URL y la llamada make_request método:

Aquí está la respuesta:

Este parámetro devuelve más detalles sobre el producto, tales como product_cost, external_ref, smart_price y Direcciones URL. Por lo tanto nos interesa Direcciones URL, así que a bucear en otros en próximos posts.

Ya que nos queremos centrar en direcciones URL campo vamos a desenterrar. Contiene una matriz de enteros, cada uno apuntando a una URL perteneciente a este producto. En este producto, hay 4 Direcciones URL cuyo ID son 8273503, 8273504, 8273505 y 8273506.

Debido a que tenemos ID de la URL, siguiente paso es llamar a obtener una dirección URL determinada (link to doc) punto final.

Conseguir una URL concreta

Es sólo un simple for loop iteración de las identificaciones de URL y conseguir los detalles del enlace:

and here is the output of the piece of code:

… (hay 3 other URL data, so I just removed them for the sake of simplicity.)


In the URL details, there is several fields and most of them self explanatory. For the details of each field, you can look up in the API docs.

Since we have all the competitor prices, it is easy to write a piece of code to find the items which got más de 10% discounts today:

Finalmente, the output is:

Discount alert at https://www.COOLBLUE.nl/Product/793610/Apple-iPhone-x-64gb-Zilver.html


And finally we know that COOLBLUE.nl discounted the price more than 10% hoy.


To sum up all the code of this post:

There are numerous things to do if you have access to the competitor prices, which Prisync can proudly present. Just to mention a few of them:

  • First of all you can monitor your competitors actively and generate custom alerts depending on your pricing strategy.
  • in addition to that, set your prices when the market is stale so that you can create volatility, which directly affects your profit margins.
  • Another feature you can develop is ignoring discounts if the stock is not available on the competitor.
  • in addition, you can implement other ideas that you and your team come up with!

Thanks for following up to this point. This is the second post of our API article series. See you in next posts of Prisync API Tutorial Series.