Incrementally import recently updated products with Spryker Middleware Powered by Alumio

Edit on GitHub

This document describes how to import products that have recently been updated. Following the described procedure, you can import products that have been updated within the past day.

To run the incremental import of products, follow these steps.

1. Configure the Spryker Middleware Powered by Alumio connection with Akeneo PIM and Spryker

2. Configure the data mapping between Akeneo and Spryker

3. Create an incoming configuration

  1. In Spryker Middleware powered by Alumio, go to Connections > Incoming and click +. This opens the Create an incoming configuration page.
  2. For Name, enter the name for this configuration. As you are entering the name, the Identifier is automatically populated.
  3. Optional: For Description, add the description of the configuration.
  4. To activate the incoming configuration after creating, make sure Status is set to Enabled.
  5. For Subscriber, enter and select HTTP Subscriber.
  6. For Request URI, enter /api/rest/v1/products.
  7. In HTTP Client, enter and select the Akeneo client you created in Connect Akeneo with Spryker Middleware powered by Alumio.

akeneo-client

  1. For Input transformer, select Chain.
  2. Click Add data transformer.
  3. For Select a prototype, select Value setter.
  4. For Key, enter lastTimestamp.

input-transformer

  1. Click Add data transformer.
  2. For Select a prototype, select Get an entity from storage.
  3. For Storage, enter and select the storage you created. For example, [Default] Akeneo to Spryker - Products - update lastTimestamp. For instructions on creating new storage, see Create cache.
  4. For Storage entity identifier, enter lastTimestamp.
  5. For Destination, enter lastTimestamp.

entity-from-storage

  1. Click Add data transformer.
  2. For Select a prototype, select Conditional transformer.
  3. For If all conditions are met, select Value condition.
  4. For Accessor, select Pattern accessor.
  5. For Pattern, enter lastTimestamp.
  6. For Conditions, click Add conditions.
  7. For Select a prototype, select is empty.

conditional-transformer

  1. In Then apply transformer, for Select a prototype, select Value setter.
  2. For Key, enter LastTimestamp.
  3. For Value, select string and enter -1 day.
  4. For Mappers, click Add a mapper.
  5. For Select a prototype, select Format: Date.
  6. For Output format, enter Y-m-d H:i:s.

apply-transformer

  1. For Follow pagination, select Follow next links.
  2. For Pattern to the link for the next page, enter _links.next.href.
  3. In Maximum number of pages to fetch, enter the needed value. For example, 100.
  4. For Entity schema, select Akeneo Product.

response-decoder

  1. Click Save & continue. This opens the edit page for this configuration with a success message displayed.

4. Create an outgoing connection

For the incremental import to work, you need to add to your outgoing connection an additional entity transformer with two data transformers in it.

To create the additional transformer, follow the steps:

  1. In the Spryker Middleware powered by Alumio platform, go to Connections > Entity transformers and click +. This opens the Create an entity transformer page.

  2. For Name, enter the name for the entity transformer. As you are entering the name, the Identifier is automatically populated based on the name.

  3. Optional: In Description, add the description for the transformer.

  4. To activate the entity transformer after creating, set the status to Enabled.

  5. For Settings, select Chain multiple entity transformers. add entity transformer

  6. Click Add entity transformer.

  7. For Select a prototype or configuration, enter and select Data, transform using mappers and conditions. This is the first data transformer in the entity transformer.

  8. In Data transformers click Add data transformer.

  9. For Select a prototype, enter and select Value setter.

  10. For Configurations > Key, enter lastTimestamp.

  11. For Value, select string and enter &{updated}.

  12. In Mappers, click Add a mapper.

  13. For Select a prototype, enter and select String: Replace.

  14. For Search, enter T.

  15. Click Add a mapper.

  16. For Select a prototype, enter and select String: Cut.

  17. For Start, enter 0.

  18. For Length, enter 19.

manage-name

  1. Click Add entity transformer.
  2. For Select a prototype or configuration, enter and select Data, transform using mappers and conditions This is the second data transformer in the entity transformer.
  3. In Data transformers click Add data transformer.
  4. For Select a prototype, enter and select select Save entity to storage.
  5. For Storage, enter and select the storage you created when establishing the incoming configuration at Create an incoming configuration. In our example, it’s [Default] Akeneo to Spryker - Products - update lastTimestamp.
  6. For Storage entity identifier, enter lastTimestamp.
  7. For Source, enter lastTimestamp.
  8. Click Save & continue. This opens the edit page for this connection with a success message displayed.

5. Define the route

Define the route as described in Define the route.

6. Create tasks and import products from Akeneo to SCCOS

Follow the instructions in Create tasks and import products from Akeneo to SCCOS.