Custom Property: Create
This API is extremely reliable and will not be broken unless absolutely necessary.
Method
POST
Path
/qrs/CustomPropertyDefinition
Description
Create a custom property that you can apply to a resource. To learn how to apply a custom property to a resource, see Example: Apply a custom property to a resource.
Body
{ "name": "Region", "valueType": "Text", "choiceValues": [ "Americas", "APAC", "EMEA" ] }
Return value
{ "id": "37e502a9-dbfa-4a1a-8f6e-ade3960b7dfe", "createdDate": "2017-01-06T14:58:27.266Z", "modifiedDate": "2017-01-06T14:58:27.266Z", "modifiedByUserName": "INTERNAL\\sa_repository", "name": "Region", "valueType": "Text", "choiceValues": [ "Americas", "APAC", "EMEA" ], "objectTypes": [], "privileges": null, "impactSecurityAccess": false, "schemaPath": "CustomPropertyDefinition" }
Optional parameters
-
Example: Apply a custom property to a resource
Now that you have a custom property, the next step is to make it available to resources so that you can start using it. In this example, you'll learn how to assign a custom property to a resource such as a user.
- Create a custom property. Use the sample code provided above.
-
Copy the entire response body and paste it into a text editor.
- Update the custom property entity so that it can be applied to a user. In this case, you want to assign the User resource type to the custom property.
- In the text editor, add "User" to the objectTypes property:
{ "id": "567481ec-d3d2-47db-8f68-ff16c24ad268", "createdDate": "2017-11-24T15:58:19.090Z", "modifiedDate": "2017-11-24T15:58:19.090Z", "modifiedByUserName": "INTERNAL\\sa_repository", "name": "Region", "valueType": "Text", "choiceValues": [ "Americas", "APAC", "EMEA" ], "objectTypes": ["User"], "privileges": null, "schemaPath": "CustomPropertyDefinition" }
Call PUT qrs/CustomPropertyDefinition/567481ec-d3d2-47db-8f68-ff16c24ad268 with the entire contents from the text editor pasted into the request body.
The custom property is now available to entities of type user.
- In the text editor, add "User" to the objectTypes property:
-
Assign the custom property to a specific user.
- Get the user entity details:
GET qrs/user/{id}
- Copy the entire response body and paste it into a text editor.
- Update customProperties as shown in the following code. For "id", substitute the ID of the custom property that you created.
{ "id": "55d82fe1-fd7f-48bb-95f2-dc1969a9df61", "createdDate": "2017-10-31T15:33:42.437Z", "modifiedDate": "2017-11-23T22:03:50.033Z", "modifiedByUserName": "INTERNAL\\sa_repository", "customProperties": [{ "value": "APAC", "definition":{ "id":"567481ec-d3d2-47db-8f68-ff16c24ad268" } }], "userId": "bll", "userDirectory": "INTERNAL", "name": "bll", "roles": [ "RootAdmin" ], "attributes": [], "inactive": false, "removedExternally": false, "blacklisted": false, "deleteProhibited": true, "tags": [], "privileges": null, "schemaPath": "User" }
- Call PUT qrs/user/{id} with the entire contents from the text editor pasted into the request body.
The custom property value "APAC" is applied to the specified user.
- Get the user entity details: