Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Depending on the desired formatting of the request, there are two headers that can be sent.

Content Type: JSON

This feature is available in version2.1.3.7
Encoding as JSON can be useful, but by default all API parameters are passed formatted as query-strings.

To activate JSON Content Encoding on a request, a header needs to be added to the request:

No Formatcode
Content-Type:application/json

...

To activate HTML decoding on a request, a header needs to be added to the request:

No Formatcode
Pcr-Html-Encoded:true

Logging

...

To activate logging on a request, a header needs to be added to the request:

No Formatcode
Pcr-Debug-Api:true


If the logging header is provided and the value is "true", the API Request will be returned in the response.

No Formatcode
languagephp
linenumberstrue
    <equipment>
        <status>success</status>
        <page>1</page>
        <count>20</count>
        <total_count>3174</total_count>
        <equipment> ... </equipment>
    </equipment>
    <debug> .... </debug>

...

We currently offer JSON , PHP , and XML output formats.
(PHP returns a serialized array which can be converted back to an array using the

...

unserialize()

...

function)


What a Request Looks like

A basic request looks like this:

No Formatcode
CALLTYPE http://DOMAIN/api/API_KEY/REQUEST.OUTPUT

...

More specific requests can be done by attaching more fields at the end of the URL in a query string:

No Formatcode
GET http://DOMAIN/api/API_KEY/REQUEST_TYPE.OUTPUT?field1=value1 ...

...

Using cURL this example queries all records in the SERVICES table and specifies the content type is JSON encoded and requests data returned JSON encoded: The application/json Content-Type feature is available starting in version 2.1.3.7

No Format
Code Block
curl -X POST -d '{"sql":"SELECT * FROM SERVICES"}' http://DOMAIN/api/API_KEY/sql.json -H Content-Type:application/json

...

Using cURL this example queries all records in the SERVICES table using the default content encoding of HTTP query string parameters and requests data returned in XML format:

No Formatcode
curl -X POST -d "sql=SELECT * FROM SERVICES" http://DOMAIN/api/API_KEY/sql.xml

...

Using cURL, this example invokes a Custom API called hello-world and the header specifies the content type is JSON encoded and requests data returned JSON encoded: The application/json Content-Type feature is available starting in version 2.1.3.7

No Format
Code Block
curl -X POST -d '{"foo":"bar"}' http://DOMAIN/api/API_KEY/hello-world.json -H Content-Type:application/json

...

Using cURL this example invokes a Custom API called example using the default content encoding of HTTP query string parameters and requests data returned in XML format:

No Formatcode
curl -X POST -d "foo=bar" http://DOMAIN/api/API_KEY/example.xml

...

All the Request Types (Equipment, Services, and Service Desk) support writing to associated UDFs. Updating UDF values requires using specific syntax in the request data. Prefix the UDFs unique identifier with "udf_" and submit the values with the other request data.

...

Code Block
languagephp
linenumberstrue
{
    "udf_IDENTIFIER1" : "VALUE1"
    "udf_IDENTIFIER2" : "VALUE2"
    "udf_IDENTIFIER3" : "VALUE3"
}



Filter by label (Content by label)navmap
cqlapi
label = "api"