Add a relationship

post/relationships
Internal-Use Only

Adds a new relationship. A relationship requires a resource, a related resource and the 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. 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. Attempting to add a relationship that already exists leaves the existing relationship unchanged.

Request Samples

1

Response Samples

1{
2 "creationTimeStamp": "2022-11-17T09:25:04.033000Z",
3 "modifiedTimeStamp": "2022-11-17T09:25:04.033000Z",
4 "id": "001bc483-2dc4-4707-860d-5107abd3e460",
5 "links": [
6 {
7 "method": "GET",
8 "rel": "self",
9 "href": "/relationships/relationships/001bc483-2dc4-4707-860d-5107abd3e460",
10 "uri": "/relationships/relationships/001bc483-2dc4-4707-860d-5107abd3e460",
11 "type": "application/vnd.sas.relationship"
12 },
13 {
14 "method": "DELETE",
15 "rel": "delete",
16 "href": "/relationships/relationships/001bc483-2dc4-4707-860d-5107abd3e460",
17 "uri": "/relationships/relationships/001bc483-2dc4-4707-860d-5107abd3e460"
18 },
19 {
20 "method": "PUT",
21 "rel": "update",
22 "href": "/relationships/relationships/001bc483-2dc4-4707-860d-5107abd3e460",
23 "uri": "/relationships/relationships/001bc483-2dc4-4707-860d-5107abd3e460",
24 "type": "application/vnd.sas.relationship",
25 "responseType": "application/vnd.sas.relationship"
26 },
27 {
28 "method": "GET",
29 "rel": "up",
30 "href": "/relationships/relationships",
31 "uri": "/relationships/relationships",
32 "type": "application/vnd.sas.collection",
33 "itemType": "application/vnd.sas.relationship"
34 }
35 ],
36 "resourceUri": "/casManagement/servers/cas-shared-default/caslibs/COMMON_PROD/tables/CONTACTS_ONLY",
37 "type": "Equivalent",
38 "relatedResourceUri": "/dataTables/dataSources/cas~fs~cas-shared-default~fs~COMMON_PROD/tables/CONTACTS_ONLY",
39 "referenceId": "b5fbc8bf-57c2-4166-ae7c-bbfd2fc226eb",
40 "relatedReferenceId": "c06dfdc9-1990-4df0-a7ec-ec517b7d9847",
41 "version": 1
42}

Request Body

A relationship.

Used to create a single relationship.

NameTypeRequiredDescription
resourceUri
string
true

The URI of the subject resource of this relationship.

referenceId
string
false

The id of the reference for the subject resource.

type
string
true

The id of this relationship type.

relatedResourceUri
string
true

The URI of the related resource of this relationship.

relatedReferenceId
string
false

The id of the reference for the related resource.

source
string
false

The source of this relationship. Typically the URI of the resource that manages this relationship.

version
integer
false

This media type's schema version number. This representation is version 1.

Responses

StatusMeaningDescription
201CreatedThe relationship was added.HeadersSchema
400Bad RequestBad request (the request is not well-formed).Schema
409ConflictThe requested object already exists.Schema