REST API description: Difference between revisions

m
no edit summary
mNo edit summary
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''':
This can be further simplified by writing the header into a separate file, for example '''api-token-header.txt'''. This also has the benefit that the credentials are not visible to every user on the system in the process list.
  Authorization: Bearer API_TOKEN
  Authorization: Bearer API_TOKEN
Now this file can be referenced by curl:
Now this file can be referenced by curl:
28

edits