Examples of calling API using curl: Difference between revisions

From Planfix
Jump to: navigation, search
No edit summary
No edit summary
Line 1: Line 1:
A few simple examples will illustrate how to work with the Planfix API.
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 / API access:
Let's assume that we have created the following data and an authorization token in the Account management /Access to API:


https://p.pfx.so/pf/db/tUa3VT.jpg
https://p.pfx.so/pf/db/tUa3VT.jpg

Revision as of 13:35, 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:

tUa3VT.jpg

APIKey = a78a8920c3bf1db81db4e11

Private key = a78a8920c3bf1db81db4e11

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&lt;br&gt;string two&lt;br&gt;&lt;b&gt;bold text&lt;/b&gt;</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&lt;br&gt;string two&lt;br&gt;&lt;b&gt;bold text&lt;/b&gt;</description>\
</action></request>' \
https://api.planfix.com/xml/


Search for a contact by phone number

(в аккаунте testo.planfix.ru)

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/


Go To