Connection to Akeneo REST API

Good afternoon everyone

I gotta configure a connection to Akeneo PIM and I cant make heads or tails of how am I supposed to configure this connection. 

1- Based on their documentation, I got to generate a token by submitting username and password in a JSON request body AND an authorization header with my client and secret in base64. 

2- This token must then be included in following requests as an authorization header UNTIL it expires. 

I must then submit a new token request. This time, using the refresh token I got in Step 1. This will return a new token that replaces the one I was using until then in step 2

Anyone has an idea ?

Here's Akeneo documentation for the record : https://api.akeneo.com/documentation/authentication.html#

0

Comments

9 comments
Date Votes
  • Official comment

    Thanks Philippe Foisy for providing your time and giving us a walk through of the challenges faced. 

    Search URL parameter will be added to the required endpoints soon. 

  • Philippe Foisy you would use OAuth 2 and override the body to get an access token. After that, the refresh mechanism is all handled in the connection since it's standard OAuth 2 implementation. 

     

    JSON so you can copy:

    Override body:
    {
        "username" : "{{{connection.http.encrypted.username}}}",
        "password" : "{{{connection.http.encrypted.password}}}",
        "grant_type": "password"
     }

    Connection settings:
    {
      "username" : "",
      "password" : ""
     }
    0
  • Tyler Lamparter you are a life saver ! Thank you so much for this very precise walkthrough of the configuration !

    0
  • Hi Tyler Lamparter

    Thank you for the detailed walkthrough; it's greatly appreciated. I attempted to follow your steps and encountered two issues:

    1. It appears that akeneo.cloud is not recognized as a valid domain name. However, I had success using akeneo.com and api.akeneo.com.

    2. After completing all the required fields, I received an error during the connection process: "Expected field: AuthURI to be present."

     

    Would appreciate any insights you can offer to resolve these issues. Thank you!

    As an addition, you can also create a connection without using an iClient by utilizing a token instead. Here are some screenshots for reference:

    Important: Make sure to populate the HTTP header with the Authorization field. In the placeholder marked as "removed====", insert your Base64-encoded ClientID and Secret.

    In Postman, you can generate this code using the following pre-request script:

     
    postman.setEnvironmentVariable(
      "base64ClientIdSecret",
      btoa(
        postman.getEnvironmentVariable("clientId") + ':' + postman.getEnvironmentVariable("secret")
      )
    );




     

    Hope this helps :)

    0
  • Nuri Ensing the authURI should only be required when your OAuth2 iClient is configured for "Authorization code" grant type and not "Client credential" grant type. If it's throwing that error and you have it configured to client credentials, then I'd be curious to know how to reproduce what you did. When you made it, did you change the setup of an existing connection or did you start a new connection from scratch for the Oauth2 configuration?

     

    As for the other method of making this work, you absolutely can use the refresh token method, but since this endpoint is oauth, going the oauth route will present fields that are relevant to the standard. Also, on your refresh method, you don't have to pre generate your base64 encoded string in Postman and we would highly recommend you don't store sensitive credentials in non encrypted fields. Here is how your refresh token method should look like with encrypted fields.

    Basic {{{base64Encode connection.http.encrypted.clientId":" connection.http.encrypted.clientSecret}}}
    {
      "username": "{{{connection.http.encrypted.username}}}",
      "password": "{{{connection.http.encrypted.password}}}",
      "grant_type": "password"
    }

     

    Encrypted fields, but populate with real values:

    {
      "username": "",
      "password": "",
      "clientId": "",
      "clientSecret": ""
    }


    Unencrypted fields to know the structure placed in encrypted fields if you ever have to come back and update.

    {
      "username": "copy this json structure to encrypted field. structure is here so that structure is known in the future after saving this connection",
      "password": "copy this json structure to encrypted field. structure is here so that structure is known in the future after saving this connection",
      "clientId": "copy this json structure to encrypted field. structure is here so that structure is known in the future after saving this connection",
      "clientSecret": "copy this json structure to encrypted field. structure is here so that structure is known in the future after saving this connection"
    }
    0
  • Philippe Foisy and fellow Celigo + Akeneo customers, 

    We added the prebuilt Akeneo connector in the September 2023 release. Hopefully, it streamlines your flow development, and we welcome any feedback you might have. 

    0
  • Hey Stephen ! 

    Thanks for this announcement ! I'm going to take a look at it ASAP

    Regards

    0
  • Hey Stephen Brandt

    I've tried the Akeneo connector extensively. Sadly it does not cover all the uses cases I have in its current version. Here's a couple of comments : 

    • The documentation listing all the supported API endpoints does not list the actual endpoints. "Submarizing" the endpoint action is not really helpful. Especially when try to convert from an HTTP connector to this one. Trying to find the "corresponding" API endpoint is difficult
    • Seems like all the endpoint where you need to provide a payload (POST, PATCH, PUT) actually do not allow us to provide the payload while in the "simple" view
    • Seems like the search URL param is not supported on all "supported endpoints". Which renders some endpoint falsely usable depending on the use cases
    • Seems like whenever you try to use the "HTTP" version of the connector, save and reopen the import/export, the params are completetly screwed up. My guess is that Celigo tries to "translate" what was writted in the "HTTP" view into the "simple" view and drops anything it does not support.
    • When I was sure I was not able to use the connector in an import/export, I could not revert back to my previous HTTP connexion.

    All in all, I'm using Akeneo's API extensively so if you guys wanna chat about the challenges I'm facing. It'll be my pleasure

    0
  • Thanks for helping us improve, Philippe. Our Product team is looking forward to this chat, and we'll try to keep this space posted with updates. 

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post