Update or create relationships

post/relationships
Internal-Use Only

A relationship requires a resource, a related resource, and a relationship type. A resource can be specified by either a resource URI or a reference ID. The related resource can be defined by either a related resource URI or a related reference ID. Relationship uniqueness is defined by the combination of the resource and the related resource. When the ID is provided, this operation performs a full replacement of the relationship. When no ID is provided, and the relationship is not unique, the relationship is not updated. The parameter ?onConflict=update can be used to update existing relationships with a matching resource and related URIs. The ID field cannot be updated during this operation. The response is a collection of application/vnd.sas.relationship resources. When a resource creation or update fails, the collection includes an application/vnd.sas.error object that describes why the operation failed. If an invalid reference ID is provided a 404 is returned. If a reference does not exist for a resource URI a reeference will be created. When possible, additional resource information is queried and added to the reference. For resources external to the SAS system, the client should provide additional reference information. The media type application/vnd.sas.collection+json is required for this endpoint to prevent ambiguity with other POST operations to this collection.

Request Samples

1

Response Samples

1{
2 "version": 2,
3 "accept": "application/vnd.sas.relationship+json application/vnd.sas.error",
4 "count": 3,
5 "start": 0,
6 "limit": 3,
7 "name": "items",
8 "items": [
9 {
10 "version": 2,
11 "httpStatusCode": 409,
12 "errorCode": 10610,
13 "message": "Conflict",
14 "details": [
15 "A relationship already exists with the specified endpoints: c40c242b-952a-4750-838a-d7559192b558"
16 ]
17 },
18 {
19 "creationTimeStamp": "2022-11-19T02:19:16.844000Z",
20 "createdBy": "sasuser",
21 "modifiedTimeStamp": "2022-11-19T02:19:16.844000Z",
22 "modifiedBy": "sasuser",
23 "id": "c40c242b-952a-4750-838a-d7559192b558",
24 "links": [
25 {
26 "method": "GET",
27 "rel": "self",
28 "href": "/relationships/relationships/c40c242b-952a-4750-838a-d7559192b558",
29 "uri": "/relationships/relationships/c40c242b-952a-4750-838a-d7559192b558",
30 "type": "application/vnd.sas.relationship"
31 },
32 {
33 "method": "DELETE",
34 "rel": "delete",
35 "href": "/relationships/relationships/c40c242b-952a-4750-838a-d7559192b558",
36 "uri": "/relationships/relationships/c40c242b-952a-4750-838a-d7559192b558"
37 },
38 {
39 "method": "PUT",
40 "rel": "update",
41 "href": "/relationships/relationships/c40c242b-952a-4750-838a-d7559192b558",
42 "uri": "/relationships/relationships/c40c242b-952a-4750-838a-d7559192b558",
43 "type": "application/vnd.sas.relationship",
44 "responseType": "application/vnd.sas.relationship"
45 },
46 {
47 "method": "GET",
48 "rel": "up",
49 "href": "/relationships/relationships",
50 "uri": "/relationships/relationships",
51 "type": "application/vnd.sas.collection",
52 "itemType": "application/vnd.sas.relationship"
53 }
54 ],
55 "resourceUri": "/containers/containerUri",
56 "type": "Contains",
57 "relatedResourceUri": "/items/item1Uri",
58 "referenceId": "228dff66-0b62-4217-b686-a62ef881228a",
59 "relatedReferenceId": "cdca263d-c7b3-494c-9868-191d81699414",
60 "version": 1
61 },
62 {
63 "creationTimeStamp": "2022-11-19T02:19:16.907000Z",
64 "createdBy": "sasuser",
65 "modifiedTimeStamp": "2022-11-19T02:19:16.907000Z",
66 "modifiedBy": "sasuser",
67 "id": "ce6a0656-c437-4ed0-9418-5a866908b53f",
68 "links": [
69 {
70 "method": "GET",
71 "rel": "self",
72 "href": "/relationships/relationships/ce6a0656-c437-4ed0-9418-5a866908b53f",
73 "uri": "/relationships/relationships/ce6a0656-c437-4ed0-9418-5a866908b53f",
74 "type": "application/vnd.sas.relationship"
75 },
76 {
77 "method": "DELETE",
78 "rel": "delete",
79 "href": "/relationships/relationships/ce6a0656-c437-4ed0-9418-5a866908b53f",
80 "uri": "/relationships/relationships/ce6a0656-c437-4ed0-9418-5a866908b53f"
81 },
82 {
83 "method": "PUT",
84 "rel": "update",
85 "href": "/relationships/relationships/ce6a0656-c437-4ed0-9418-5a866908b53f",
86 "uri": "/relationships/relationships/ce6a0656-c437-4ed0-9418-5a866908b53f",
87 "type": "application/vnd.sas.relationship",
88 "responseType": "application/vnd.sas.relationship"
89 },
90 {
91 "method": "GET",
92 "rel": "up",
93 "href": "/relationships/relationships",
94 "uri": "/relationships/relationships",
95 "type": "application/vnd.sas.collection",
96 "itemType": "application/vnd.sas.relationship"
97 }
98 ],
99 "resourceUri": "/containers/containerUri",
100 "type": "Contains",
101 "relatedResourceUri": "/items/item2Uri",
102 "referenceId": "228dff66-0b62-4217-b686-a62ef881228a",
103 "relatedReferenceId": "89d61f3d-f94b-47ca-9fdd-6bc1eb63c074",
104 "version": 1
105 }
106 ],
107 "links": [
108 {
109 "method": "GET",
110 "rel": "self",
111 "href": "/relationships/relationships?start=0&limit=10&sortBy=id",
112 "uri": "/relationships/relationships?start=0&limit=10&sortBy=id",
113 "type": "application/vnd.sas.collection",
114 "itemType": "application/vnd.sas.relationship+json"
115 },
116 {
117 "method": "GET",
118 "rel": "collection",
119 "href": "/relationships/relationships",
120 "uri": "/relationships/relationships",
121 "type": "application/vnd.sas.collection",
122 "itemType": "application/vnd.sas.relationship+json"
123 },
124 {
125 "method": "POST",
126 "rel": "create",
127 "href": "/relationships/relationships",
128 "uri": "/relationships/relationships",
129 "type": "application/vnd.sas.relationship",
130 "responseType": "application/vnd.sas.relationship"
131 }
132 ]
133}

Query Parameters

NameTypeRequiredDescription
onConflict
string
false

How to handle conflicts when a reference already exists.

Allowed values:
updateignore

Header Parameters

NameTypeRequiredDescription
If-Unmodified-Since
string
false

The value of the lastModified date of the relationship. If the relationship has been updated since this time, the update will fail. This header is only required when the onConflict='update' parameter is specified, and is only applied to relationships being updated.

Request Body

A collection of application/vnd.sas.relationship resources.

A collection used to create multiple relationships.

NameTypeRequiredDescription
accept
string
false

A space-delimited list of media types from which an Accept header may be constructed.

count
integer<int64>
false

If populated indicates the number of items in the collection.

limit
integer
false

The number of items that were requested for the collection.

links
array [Link]
false

The links that apply to the collection.

name
string
false

The name of the collection.

start
integer<int64>
false

The zero-based index of the first item in the collection.

version
integer
false

The version number of the collection representation. This representation is version 2.

items
array [Create relationship]
false

The array of application/vnd.sas.relationship representations.

Responses

StatusMeaningDescription
200OKOk.HeadersSchema
400Bad RequestBad request (the request is not well-formed).Schema