Examples of calling API using curl: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
https://s.pfx.so/pf/C6/WTdNRp.jpg | https://s.pfx.so/pf/C6/WTdNRp.jpg | ||
APIKey = | APIKey = caf9e72923b5a3d5fa48399 | ||
Authorization token = 2e21b0cc82756f0554a6f4d | |||
== Adding a comment to a task == | == Adding a comment to a task == | ||
(task number 23525 in the test.planfix.com account) | (task number 23525 in the test.planfix.com account) |
Revision as of 13:59, 19 June 2024
A few simple examples will illustrate how to work with the Planfix API.
Let's assume that we have created the following data and an authorization token in the Account management /Access to API:
APIKey = caf9e72923b5a3d5fa48399
Authorization token = 2e21b0cc82756f0554a6f4d
Adding a comment to a task
(task number 23525 in the test.planfix.com account)
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u 583e3bcc38f34a4af6d8deadbeef8e2d:277ebe9f3a5770adeadbeefa2bc3dbb8 \
-d '<request method="action.add">\
<account>test</account>\
<action>\
<task><general>23525</general></task>\
<description>comment text</description>\
</action></request>' \
https://api.planfix.com/xml/
Adding a comment to a task with HTML markup
(task number 23525 in the test.planfix.com account)
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u 583e3bcc38f34a4af6d8deadbeef8e2d:277ebe9f3a5770adeadbeefa2bc3dbb8 \
-d '<request method="action.add">\
<account>test</account>\
<action>\
<task><general>23525</general></task>\
<description>string one<br>string two<br><b>bold text</b></description>\
</action></request>' \
https://api.planfix.com/xml/
Adding a comment to a contact
(contact number 12300 in the test.planfix.com account with HTML markup)
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u 583e3bcc38f34a4af6d8deadbeef8e2d:277ebe9f3a5770adeadbeefa2bc3dbb8 \
-d '<request method="action.add">\
<account>test</account>\
<action>\
<contact><general>12300</general></contact>\
<description>string one<br>string two<br><b>bold text</b></description>\
</action></request>' \
https://api.planfix.com/xml/
Search for a contact by phone number
(in the test.planfix.com account)
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u 583e3bcc38f34a4af6d8deadbeef8e2d:277ebe9f3a5770adeadbeefa2bc3dbb8 \
-d '<request method="contact.getList">\
<account>test</account>\
<pageCurrent>1</pageCurrent>\
<pageSize>10</pageSize>
<filters><filter>\
<type>4003</type>\
<operator>equal</operator>\
<value>123456</value>\
</filter></filters></request>' \
https://api.planfix.com/xml/
Search for a contact by field value (string type)
(with field ID 10123, in the test.planfix.com account) (Field IDs can be determined using the contact.get method for the contact template with this field)
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u 583e3bcc38f34a4af6d8deadbeef8e2d:277ebe9f3a5770adeadbeefa2bc3dbb8 \
-d '<request method="contact.getList">\
<account>test</account>\
<pageCurrent>1</pageCurrent>\
<pageSize>10</pageSize>
<filters><filter>\
<type>4101</type>\
<field>10123</field>\
<operator>equal</operator>\
<value>value_fo_find</value>\
</filter></filters></request>' \
https://api.planfix.com/xml/
Search for a task by field value (string type)
(with field ID 10123, in the test.planfix.com account) (field IDs can be determined using the task.get method on the task template with this field, filter reference - Planfix API Filter)
curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' \
-u 583e3bcc38f34a4af6d8deadbeef8e2d:277ebe9f3a5770adeadbeefa2bc3dbb8 \
-d '<request method="task.getList">\
<account>test</account>\
<pageCurrent>1</pageCurrent>\
<pageSize>10</pageSize>
<filters><filter>\
<type>101</type>\
<field>10123</field>\
<operator>equal</operator>\
<value>value_fo_find</value>\
</filter></filters></request>' \
https://api.planfix.com/xml/