ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Clarity : Resources Rest API How - To's

book

Article ID: 145738

calendar_today

Updated On:

Products

Clarity PPM On Premise

Issue/Introduction

This article is a how-to guide in utilizing the resources API in Clarity PPM 15.7.1

Environment

Release : 15.7.1

Component : CA PPM REST API

Resolution

1. Resources API currently support only updates to existing resource information and doesn't support addition of new resources through API. If you have a requirement for adding new resources, you can use XOG functionaity.

2. Connect using a REST API Client such as Postman.
3. Retrieving Resource Details. Note :- the retrieval uses the internal ID of the resource i.e. 5 million id. You can query your database to find this out (select id from srm_resources where unique_name='resourceid';).

Request URL :- http(s)://hostname.domain.com/ppm/rest/v1/resources (Note :- the page size is 25, so only 25 resources are retrieved.)



You can retrieve the next records i.e. in batches of 25 using the below request.

GET Request :- http(s)://hostname.domain.com/ppm/rest/v1/resources?offset=25 (this retrieves resources from 25-50).
GET Request :- http(s)://hostname.domain.com/ppm/rest/v1/resources?offset=50 (this retrieves resources from 50-75) and so on.

4. Retrieving Data of a Single Resource. We are trying to retrieve Resource information of admin user who has internal ID as 1.

Request URL :-http(s)://hostname.domain.com/ppm/rest/v1/resources/1

Attributes that are retrieved.
lastName
firstName
definedTeamId
manager
employmentType
forecastRate
inputTypeCode
isRole
fullName
openForTimeEntry
availability
isActive
primaryRole
uniqueName
trackMode
email
resourceType

5. How to update resource information through Rest API? Resources API supports PUT and PATCH methods to perform updates, we will first demonstrate the PATCH Method.

Pre-Requisites :- You need to have the internal ID of the resource for whom you are planning to update the resource information. In this example we will use the admin user with internal id 1 and change his Firstname and Last Name.

PATCH Request URL :- http(s)://hostname.domain.com/ppm/rest/v1/resources/1

JSON Request :-
{
"lastName": "Test",
"firstName": "Resources API",
"uniqueName": "admin"
}



Status 200 is received as a success message, and application shows the updated data.



6. Using the PUT method to Update.

PUT Request URL :- http(s)://hostname.domain.com/ppm/rest/v1/resources/1

Additional Headers :- x-api-force-patch = true

JSON Request :-
{
"lastName": "Test PUT",
"firstName": "Resources API",
"uniqueName": "admin"
}

Status 200 is received as a success message, and application shows the updated data.

Additional Information

For SaaS customers who are configured with Portal, please refer to this document.

Attachments