How can I try the DistributionGate API?
  • 28 Jun 2022
  • 1 Minute to read
  • Contributors
  • Dark
    Light

How can I try the DistributionGate API?

  • Dark
    Light

Article Summary

Client ID and Client Secret

We can provide you with a Client ID and a Client Secret, so you can request a token and use the API.

In this article, we describe how you can try our API — shown in the graph on the left side. No user credentials are required.

The implementation of the API in your software — in the graph on the right — is described in another article.

Test access and implementation

test_access.png

Access API

Please contact us to get a Client ID and a Client Secret.

API in GraphiQL oder Insomnia ausprobieren

Wir beschreiben Ihnen zwei Wege, wie Sie die API testen können. Wenn Sie sich mit Web APIs auskennen, können Sie auch unten bei "Allgemeines Vorgehen" schauen.

Insomnia: Sie nutzen die OpenSource Software "Insomnia", um das Token abzurufen und eine GraphQL-Abfrage zu schreiben. Sie können Insomnia auch nur nutzen, um das Token abzurufen und machen dann mit GraphiQL weiter. Wir empfehlen Insomnia, wenn Sie neu im Thema sind und Windows als Betriebssystem verwenden.

GraphiQL: Sie nutzen das Kommandozeilen-Tool "cURL", das auf Linux und Mac OS vorinstalliert ist und die Browseroberfläche GraphiQL. Um das Authentifizierungs-Token bei den Requests mitzuschicken, brauchen Sie eine Erweiterung, die die Header manipuliert. Wir empfehlen eine Erweiterung in dem Artikel.

Get authorization token

Add your Client ID and Client Secret and request a token.

curl --request POST \
  --url https://promaterial.eu.auth0.com/oauth/token \
  --header 'content-type: application/json' \
  --data '{
      "client_id":"<Your Client ID>",
      "client_secret":"<Your Client Secret>",
      "audience":"http://mdg.promaterial.com/api",
      "grant_type":"client_credentials"
      }'

Answer:

{
  "access_token": "<Access token, valid for 24 hours>",
  "scope": "read:products read:order read:shoppingCart",
  "expires_in": 86400,
  "token_type": "Bearer"
}

Was this article helpful?