Planfix API: Authentication by token: Difference between revisions

From Planfix
Jump to: navigation, search
No edit summary
No edit summary
Line 16: Line 16:


<div style="display: block; padding: 1em; margin: 0 0 10px; font-size: 13px; line-height: 1.65; color: black; word-wrap: break-word; background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 4px;">
<div style="display: block; padding: 1em; margin: 0 0 10px; font-size: 13px; line-height: 1.65; color: black; word-wrap: break-word; background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 4px;">
<nowiki>
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u 4db09df5a62a8a32a9522fcac02d3c6f:06540b851b466ccf84558573aff11b65 -k -d '<request>...</request>' https://api.planfix.ru/xml/
-u 4db09df5a62a8a32a9522fcac02d3c6f:06540b851b466ccf84558573aff11b65 -k -d '<request>...</request>' https://api.planfix.ru/xml/
</nowiki>
</div>
</div>

Revision as of 11:49, 30 June 2022

When authenticating using a token, each API call must contain a basic HTTP authentication header. Authentication tokens are created in the section Account Management / API Access, and they can be limited to only specific functions.

In the example in the screenshot, only one authentication token is created, which, when used, will result in requests being made on behalf of the user John Smith (meaning requests to get tasks will return only tasks available to this user)

Картинка

If you want to use the API to modify all tasks, you can use a Robot

When authorizing using a token, use the API Key as the user and the authentication token as the password in the basic HTTP authentication header. When authorizing using a username and password, using the API Key as the user and leave the password empty. Example with token authentication:

curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \ -u 4db09df5a62a8a32a9522fcac02d3c6f:06540b851b466ccf84558573aff11b65 -k -d '<request>...</request>' https://api.planfix.ru/xml/