Resources service


Resources

Resources are the protected endpoints that applications request access to using OAuth 2 authorization services. For example, https://api.pingone.com is a defined resource that represents the PingOne for Customers APIs. PingOne also defines an openid resource that uses OpenID Connect scopes with the /{environmentId}/as/userinfo endpoint to request specific sets of information as claim values in the ID token. For more information about the userinfo endpoint requests, see Userinfo authorization requests. You can also define custom resources to associate with applications.

Resources have scopes, and applications can request an access token that is associated with specific scopes when the token is granted. The endpoint enforces access through the encoded representation of the scopes in the access token. The endpoint decodes the token to determine the permissions allowed for the application.

For more information about scopes, see Scopes service.

The examples that follow show common actions to find and manage resources entities. You need the Client Application Developer role to perform operations on resources entities.

Resources API operations

The resources service supports the following endpoint operations:

For hands-on experience with the resources API endpoints, click the Run in Postman button below to download a Postman collection that you can import and open in your local Postman application.

Resources data model

Property Description
createdAt The time the resource was created.
description A string that specifies the description of the resource.
environment.id A string that specifies the environment resource’s unique identifier associated with the resource.
id A string that specifies the resource’s unique identifier.
name A string that specifies the resource name, which must be provided and must be unique within an environment.
type A string that specifies the type of resource. Options are PLATFORM and CUSTOM.
updatedAt The time the resource was last updated.

Response codes

Code Message
200 Successful operation.
201 Successfully created.
204 Successfully removed. No content.
400 The request was invalid.
401 You weren’t authenticated to perform this operation.
404 The specified object doesn’t exist.

Endpoint examples

Get resources

The GET /environments/{environmentId}/resources endpoint returns a list of all resource entities associated with the specified environment resource.

curl -X "GET" "https://api.pingone.com/v1/environments/{environmentId}/resources" \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer jwtToken'

The response data looks like this:

{
  "_links" : {
    "self" : {
      "href" : "https://api.pingone.com/v1/environments/0271641f-2d74-4bb0-b416-4a39b8714261/resources"
    }
  },
  "_embedded" : {
    "items" : [ {
      "_links" : {
        "self" : {
          "href" : "https://api.pingone.com/v1/environments/0271641f-2d74-4bb0-b416-4a39b8714261/resources/607d2326-5d08-475d-aab3-8e8df5237c18"
        },
        "environment" : {
          "href" : "https://api.pingone.com/v1/environments/0271641f-2d74-4bb0-b416-4a39b8714261"
        }
      },
      "id" : "607d2326-5d08-475d-aab3-8e8df5237c18",
      "name" : "https://api.pingone.com",
      "description" : "APIs to manage all aspects of the PingOne platform."
    }, {
      "_links" : {
        "self" : {
          "href" : "https://api.pingone.com/v1/environments/0271641f-2d74-4bb0-b416-4a39b8714261/resources/79d29353-1508-4276-b0fa-2bffd5566aed"
        },
        "environment" : {
          "href" : "https://api.pingone.com/v1/environments/0271641f-2d74-4bb0-b416-4a39b8714261"
        }
      },
      "id" : "79d29353-1508-4276-b0fa-2bffd5566aed",
      "name" : "openid",
      "description" : "OpenID Connect scopes can be used to request that specific sets of information be made available as Claim Values in the ID token and the userinfo endpoint."
    } ]
  },
  "count" : 2,
  "size" : 2
}

Get one resource

To get data for a single resource entity, the GET /environments/{environmentId}/resources/{resourceId} operation returns data for the resource entity with the specified ID.

curl -X GET "https://api.pingone.com//v1/environments/{environmentId}/resources/{resourceId}" \
-H "Content-type: application/json" \
-H "Authorization: Bearer jwtToken"

Create resources

The POST /environments/{environmentId}/resources operation adds a new resource entity to the specified environment resource.

curl -X "POST" "https://api.pingone.com/v1/environments/{environmentId}/resources" \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer jwtToken' \
-d $'{
  "name": "MyNewResource"
}'

The request body must specify a value for the resource entity’s name property, and the name value must be unique within the specified environment resource.

Update resources

The PUT /environments/{environmentId}/resources/{resourceId} operation updates the property values of the identified resource entity.

curl -X "PUT" "https://api.pingone.com/v1/environments/{environmentId}/resources/{resourceId}" \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer jwtToken' \
-d $'{
  "name": "https://api.photostore.com",
  "description": "Resource for PhotoStore application endpoints."
}'

The request body specifies updated property values for the resource name and description. Any property values not specified in the request body are cleared. The response returns a 200 OK message, and it shows the updated property data for the modified resource entity.

Delete resources

The following sample shows the DELETE /environments/{environmentId}/resources/{resourceId} operation to delete the resource entity specified by its ID in the request URL.

curl -X DELETE "https://api.pingone.com/v1/environments/f29547a1-841c-45f8-977e-00d0fdb73ede" \
-H "Content-type: application/json" \
-H "Authorization: Bearer jwtToken" \

When successful, the DELETE request returns a code 204 No Content message.