Examples of calling API using curl: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
Let's assume that we have created the following data and an authorization token in the Account management /Access to API: | Let's assume that we have created the following data and an authorization token in the Account management /Access to API: | ||
https://s.pfx.so/pf/ | https://s.pfx.so/pf/2L/gkoYwa.jpg | ||
APIKey = caf9e72923b5a3d5fa48399 | APIKey = caf9e72923b5a3d5fa48399 | ||
Line 88: | Line 88: | ||
== Search for a task by field value (string type) == | == Search for a task by field value (string type) == | ||
(with field ID 10123, in the test.planfix.com account) | (with field ID 10123, in the test.planfix.com account) | ||
(field IDs can be determined using the [[Planfix API task.get|task.get]] method on the task template with this field, filter reference - [[Planfix API | (field IDs can be determined using the [[Planfix API task.get|task.get]] method on the task template with this field, filter reference - [[Planfix API:Task filters]]) | ||
<source lang="bash"> | <source lang="bash"> |
Latest revision as of 14:03, 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:Task filters)
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/