Requests
REST APIs use standard HTTP requests to interact with resources. The DPS API requires that you use HTTPS (secure HTTP) for all requests. Each request consists of an HTTP verb, the endpoint (URL) which identifies the resource, the header, and the request body.
Verb
REST APIs rely on the four standard HTTP verbs to access and manipulate resources:
- POST creates the resource
- GET reads the resource
- PUT updates the resource
- DELETE deletes the resource
Note: PUT and POST behave as PATCH. The entire resource is not required for either type of API call.
The endpoint is a URL that identifies the resource you want to access. Endpoints have a form like the following:
{{base_url}}/contact/123456789
- The domain is typically represented by a variable, such as base_url in the preceding request. For example, base_url might resolve to a path such as company.deltek.com/company/api
- The path to the resource can include one or more segments, such as contact and 123456789 in the preceding example, where 123456789 is the ID of the specific contact you are requesting.
Request Header
At a minimum, the request header typically specifies:
- The access_token to authenticate you to the server
- The content-type to identify the format of the data
- The date
For example:
authorization: Bearer {{oauth_token}} content-type: application/json; charset=utf-8 Cache-Control: no-cache, no-transform Date: Tue, 11 Nov 2014 12:55:40 GMT
The header also can specify the HTTP version and language:
HTTP/1.1 200 OK Content-Language: en-US-x-lvariant-W
Example
Here is a request to get the contact with ID 123456789. This example uses the cURL command line tool to submit the request.
curl --request GET \ --url 'https://{{url}}/contact/123456789' \ --header 'authorization: Bearer {{oauth_token}}' \ --header 'content-type: application/json'