REST API description: Difference between revisions

→‎Using API token: add example with a header file
mNo edit summary
(→‎Using API token: add example with a header file)
Line 42: Line 42:
When using an API token, the authentication is added using parameter '''-H''' to add a special HTTP request header (with '''API_TOKEN''' as a placeholder for the real token):
When using an API token, the authentication is added using parameter '''-H''' to add a special HTTP request header (with '''API_TOKEN''' as a placeholder for the real token):
  curl --silent -k -H "Authorization: Bearer API_TOKEN" '<nowiki>https://allegro-mm-XXX/...'</nowiki>
  curl --silent -k -H "Authorization: Bearer API_TOKEN" '<nowiki>https://allegro-mm-XXX/...'</nowiki>
This can be further simplified by writing the header into a separate file, for example '''api-token-header.txt''':
Authorization: Bearer API_TOKEN
Now this file can be referenced by curl:
curl --silent -k -H @api-token-header.txt '<nowiki>https://allegro-mm-XXX/...'</nowiki>


=== PowerShell ===
=== PowerShell ===
28

edits