This section explains the following REST operations regarding the associations / association of the resource which have been secured with OAuth 2.0.
- Get all the associations on a resource.
- Get an association of specific type on a given resource.
- Add the associations to a resource
- Delete an association on a given resource
Note |
---|
Since the current Registry REST API did not implement the pagination right now, If the user specifies any value other than 0 for the pagestart or pageend in the REST requests will throw HTTP 404 error code. Even though the user omits the pagestart and pageend parameters to be passed with URL , the request will work with the current REST API. Pagination support to REST API will be adapted soon. |
Get all the associations on a resource
...
HTTP Method : GET
Request URI : http://<ip address>:<port>/restapi/associations?path=/_system/A&pagestart=0&pageend=0
HTTP Request Header : Authorization: Bearer <OAuth access token>
...
Table of Contents |
---|
Note | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The following terms explain the meaning of the query parameters passed with the following REST URIs.
|
Note |
---|
The { start page } and { number of records } parameters can take any value greater than or equal to 0. The { start page } and { number of records } begins with 1. If both of them are 0, then all the associations are retrieved. |
Get all the Associations on a Resource
Get an association of specific type on a given resource
Panel |
---|
HTTP Method : GET Request URI : http://<ip address>:<port>/restapi/property?path=<resource path>&name=<property name> HTTP Request Header : Authorization: Bearer <OAuth access token> Response : it retrieves the specific property associated with the given property name. Response Type : JSON |
Add properties to a resource
...
HTTP Method : POST
Request URI : http://<ip address>:<port>/restapi/property?path=<resource path>
HTTP Request Headers : Authorization: Bearer <OAuth access token>
...
Attributes | Values |
---|---|
HTTP Method | GET |
Request URI | /associations?path={ resource path }&start={ start page }&size={ number of records } |
HTTP Request Header | Authorization: Bearer { OAuth access token } |
Response | It retrieves all the associations posted on the specific resource. |
Response |
Response Type : JSON
HTTP 200 OK | |
Response Type | application/json |
Get Associations of Specific Type on a Given Resource
Attributes | Values |
---|---|
HTTP Method | GET |
Request URI | /associations?path={ resource path }&type={ association type } |
HTTP Request Header | Authorization: Bearer {OAuth access token} |
Description | It retrieves all the associations for the specific type of the given resource |
Response | HTTP 200 OK |
Response Type | application/json |
Add Associations to a Resource
Attributes | Values |
---|---|
HTTP Method | POST |
Request URI | /associations?path={resource path} |
HTTP Request Header | Authorization: Bearer {OAuth access token} Content-Type: application/json |
Payload |
...
[{ " |
...
type":" |
...
<type of the association>"," |
...
target": |
...
"<valid resource path>"}] |
...
Response : it retrieves all the properties with the added one for the given resource.
Response Type : JSON
Update properties on a given resource
...
HTTP Method : PUT
Request URI : http://<ip address>:<port>/restapi/property?path=<resource path>
HTTP Request Headers : Authorization: Bearer <OAuth access token>
...
Description | It adds the array of associations passed as the payload for the source resource |
Response | HTTP 204 No Content. |
Response Type | application/json |
Add Association to a Resource
Delete a property on a given resource
Panel |
---|
HTTP Method : DELETE Request URI :http://<ip address>:<port>/restapi/property?path=<resource path>&name=<property name> HTTP Request Headers : Authorization: Bearer <OAuth access token> Response : it retrieves rest of the properties for the given resource after deletion. Response Type : JSON |
Note |
---|
Please note the following points for the above requests.
|
...
Attributes | Values |
---|---|
HTTP Method | POST |
Request URI | /associations?path={resource path}&targetPath={target resource}&type={assocation type} |
HTTP Request Header | Authorization: Bearer {OAuth access token} Content-Type: application/json |
Payload : [ {"name":"<property name>","value":[<array of updated values>] }]
Response : it retrieves all the properties including the updated one for the given resource. The property is updated with the array of updated values
Response Type : JSON
Response | HTTP 204 No Content. |
Response Type | application/json |
Delete Associations on a Given Resource
Attributes | Values |
---|---|
HTTP Method | DELETE |
Request URI | /association?path={resource path}&targetPath={target path}&type={association type} |
Description | It deletes the association between the source and target resources for the given association type. |
Response | HTTP 204 No Content. |
Response Type | application/json |