This page shows the oAuth-Token requested from
https://api.json-content-importer.com/extra/api/gettoken.php
The request on this URL must be like this:
- method: CURL-POST
- curloptions: Here, we define the login user/password to get the token.
CURLOPT_POSTFIELDS={"user":"test", "password":"mypass"}
- Twig-template (you might try {{ _context | json_encode }} to see the full API answer:
{{ _context.access_token }}
If the API does not answer with HTTP code 200 (this does answer with 405) add “httpstatuscodemustbe200=no” to the shortcode
[jsoncontentimporterpro nameoftemplate="gettoken" httpstatuscodemustbe200=no orderofshortcodeeval=10]
This gives us the token (the token is md5(“mypass”) – in real life, this is not that easy):
a029d0df84eb5549c641e04a9ef389e5
The complete API response is ({{ _context | json_encode }}):
{"access_token":"a029d0df84eb5549c641e04a9ef389e5","token_type":"bearer","expires_in":"3600"}
In action:
a029d0df84eb5549c641e04a9ef389e5