Create Resource
POST {{apiPath}}/environments/{{envID}}/resources
The POST /environments/{{envID}}/resources
operation adds a new resource entity to the specified environment resource.
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. If a value for the accessTokenValiditySeconds
property is not specified, the new resource uses the default value of 3600 seconds. If a value for the audience
property is not specified, the value defaults to the name of the resource.
Note: For new custom resources, the sub
claim is created separately and its value is set to ${user.id}
.
Prerequisites
- See Resources for important overview information.
Property | Type | Required? |
---|---|---|
accessTokenValiditySeconds | Integer | Required |
applicationPermissionsSettings.claimEnabled | Boolean | Optional |
audience | String | Required |
description | String | Optional |
name | String | Required |
See the Resources data model for full property descriptions.
Request Body
{"name"=>"CustomResource{{$timestamp}}", "description"=>"This is my custom resource", "audience"=>"https://api.customresource{{$timestamp}}.com", "accessTokenValiditySeconds"=>7200, "applicationPermissionsSettings"=>{"claimEnabled"=>true}}
RESPONSES
status: Created
{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/resources/9fd86709-4faf-4b59-b789-f46574ffb566"},"environment":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"scopes":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/resources/9fd86709-4faf-4b59-b789-f46574ffb566/scopes"},"attributes":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/resources/9fd86709-4faf-4b59-b789-f46574ffb566/attributes"},"secret":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/resources/9fd86709-4faf-4b59-b789-f46574ffb566/secret"}},"id":"9fd86709-4faf-4b59-b789-f46574ffb566","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"name":"CustomResource1709685712","type":"CUSTOM","audience":"https://api.customresource1709685712.com","description":"This is my custom resource","createdAt":"2024-03-06T00:41:52.636Z","updatedAt":"2024-03-06T00:41:52.636Z","accessTokenValiditySeconds":7200,"introspectEndpointAuthMethod":"CLIENT_SECRET_BASIC","applicationPermissionsSettings":{"claimEnabled":true}}