Versions Compared

Key

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

Table of Contents
outlinetrue
stylenone

Getting Started with the API

...

To use the API, you'll need a unique API Key, which is used to identify yourself to the PCR-360 server and to protect your data. API keys are assigned permissions that dictate the API access. These are available on the API Permissions page page. (Note: Do not share this unique key.)

...

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

Content Type: JSON

...

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.

...

Code Block
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)


Anchor
MakingARequest
MakingARequest
What a Request Looks like

A basic request looks like this:

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

...

In this basic request example, a user of the API would replace the following:

Parameter

Replace With

CALLTYPE

We support GET and POST call types, depending on the type of request.

DOMAIN

The URL used to access your PCR-360 application

API_KEY

The unique key generated by your admin

REQUEST_TYPE

The type of request being made. Recommended type is "sql". Other available (deprecated) types are: "servicedesk", "services", and "equipment"

OUTPUT

The desired output format.

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 Formatcode
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


For more details, see API:SQL .

Cable

This REQUEST type is deprecated.

. The cable REQUEST type allows access to PCR-360 Cables and related data. View full details on Cable API :CableCalls.

Services

This REQUEST type is deprecated.

. The services REQUEST type allows access to PCR-360 Services and related data. View full details on Services API :ServicesCalls.

Equipment

This REQUEST type is deprecated.

. The equipment REQUEST type allows access to PCR-360 Equipment and related data. View full details on Equipment API :EquipmentCalls.

GLA

This REQUEST type is deprecated.

. The gla REQUEST type allows access to PCR-360 Service Desk items and related data. View full details on GLA API :GLACalls.

Service Desk

This REQUEST type is deprecated.

. This servicedesk REQUEST variant allows access to PCR-360 Service Desk items and related data. View full details on Service Desk DataAPI Calls.

Service Desk Actions

This REQUEST type is deprecated.

. The servicedesk REQUEST type allows access to PCR-360 Service Desk items and related data. View full details on Service Desk ActionsAction API Calls.

Writing Data

The PCR-360 API allows an outside application to create or update Service, Equipment, or Service Desk items or submit SNMP traps. The basic write request is much like a read request; the URL is built in a similar fashion. Like the read requests, all API write operations are done via an HTTP(s) request (using cURL or some other method). You will need to build the URL to describe the request you are making.

...

Business logic and database integrity checks are enforced when inserting or updating data. If the required data is missing or incorrect, an error will be returned with a status of "failure" and a description of the failure. Possible failures include missing required data, incorrect or missing foreign keys, non-compliance to application business rules or logic, and Custom Validation rules.

A common error that occurs is a required field missing from the write request. It is important to keep in mind that any required user-defined fields that are created for a specific service desk type will also need to be defined when creating or updating a record.

...

The cable REQUEST type allows writting PCR-360 Cables and related data. View full details on Cable API :CableCalls.

Services

The services REQUEST type allows writing PCR-360 Services and related data. View full details on Services API :ServicesCalls.

Equipment

The equipment REQUEST type allows writing PCR-360 Equipment and related data. View full details on Equipment API :EquipmentCalls.

Service Desk

The servicedesk REQUEST type allows writing PCR-360 Service Desk items and related data. View full details on Writing Service Desk DataAPI Calls.

Service Desk Actions

The servicedesk REQUEST type variant allows writing PCR-360 Service Desk Action and related data. View full details on Writing Service Desk ActionsAction API Calls.

GLA

The gla REQUEST type allows writing PCR-360 GLA Records and related data. View full details on GLA API :GLACalls.

Custom

Custom API is available starting in version 2.1.4.0
The Custom REQUEST type allows the API to invoke custom PHP logic that is saved in the application. This is very useful when interfacing with an application where you cannot control the format or data in the outbound requests. The structure of a custom request type is dependent on the identifier specified in the Custom Logic > API entry. For more information on the syntax and capabilities available in the Custom Logic > API interface, see Custom Logic Syntax.

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 Formatcode
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.

No Formatcode
languagephp
linenumberstrue
{
    "udf_IDENTIFIER1" : "VALUE1"
    "udf_IDENTIFIER2" : "VALUE2"
    "udf_IDENTIFIER3" : "VALUE3"
}



Child pages (Children Display)contentbylabel
label = "api"
styleh6cql
sorttitle