Step 3: Create a custom resource

POST {{apiPath}}/environments/{{envID}}/resources

Resources are the protected endpoints that applications request access to using OAuth 2 authorization services. For this activity, you need to create a new custom resource. For more information about custom resources and custom scopes, see Custom scopes.

The POST /environments/{{envID}}/resources creates the new custom resouce entity in the specified environment. 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.

The response returns the new resource entity's ID, which is needed in Step 4 to define the resource's scopes, and in Step 5 when you create the application's resource access grant.

Request Body

{"name"=>"CustomResource_{{$timestamp}}", "description"=>"This is my custom resource", "audience"=>"https://api.custom-resource.com", "accessTokenValiditySeconds"=>7200}

HEADERS

KeyDatatypeRequiredDescription
Authorizationstring
Content-Typestring