Create Resource Attribute
POST {{apiPath}}/environments/{{envID}}/resources/{{resourceID}}/attributes
The POST /environments/{{envID}}/resources/{{resourceID}}/attributes
operation adds a new custom resource attribute. The request URL specifies the new attribute's associated environment ID and resource ID.
The request body must specify values for the attribute name
and value
properties. The name
value must be unique within the specified environment resource and cannot use any of the reserved name
values listed in the Resource attributes data model. The request can also specify the optional idToken
and userInfo
properties to designate whether the created attribute is present as a claim in the ID token, or whether the attribute is returned by the /userinfo
endpoint. Note that these properties cannot both be set to false
. In the Authorization request header field, the accessToken
value is your full base64url-encoded JSON web token generated by the authentication service.
You can optionally use PingOne's expression language for advanced resource attribute mapping. With advanced attribute capabilities, you can write an expression that concatenates two or more user attributes in the value
property:
curl --location --request POST '{{apiPath}}/environments/{{envID}}/resources/{{resourceID}}/attributes' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {{accessToken}}' \\
--data-raw '{
"name": "fullName",
"value": "${user.name.given + ', ' + user.name.family}"
}'
Note: For more information about PingOne's expression language, see PingOne's expression language.
Prerequisites
Create a resource to get a resourceID
for the endpoint. See also Resources, especially Resource operations.
Property | Type | Required? |
---|---|---|
name | String | Required |
value | String | Required |
See the Resource attributes data model for full property descriptions.
Request Body
{"name"=>"firstName", "value"=>"${user.name.given}"}
RESPONSES
status: Created
{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/resources/faac7db8-67ce-44aa-8ae0-5ae672f5b8bf/attributes/d13991db-145a-4f4c-802e-3f6526cb246c"},"environment":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"resource":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/resources/faac7db8-67ce-44aa-8ae0-5ae672f5b8bf"}},"id":"d13991db-145a-4f4c-802e-3f6526cb246c","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"name":"firstName","value":"${user.name.given}","type":"CUSTOM","resource":{"id":"faac7db8-67ce-44aa-8ae0-5ae672f5b8bf"}}