Skip to main content

Create typeOneResource relationship

POST 

https://apis.<domain>/resources/resources/typeOneResources/:id/relationships/:related_field/

Create a typeTwoResource associated with the typeOneResource.

Authorization Action:

resource:typeTwoResources:create

Request

Path Parameters

    id stringrequired

    Globally unique ids (UUID4)

    related_field stringrequired

Body

    data objectrequired
    oneOf
    anyOf
    objectnullable
    Default value: null

Responses

Created. Assigned id and/or any other changes are in this response.

Schema
    data objectrequired
    oneOf
    anyOf
    objectnullable
    Default value: null
    included object[]
  • Array [
  • typetype (string)required

    The type member is used to describe resource objects that share common attributes and relationships.

    idid (string)required

    Each resource object’s type and id pair MUST identify a single, unique resource.

    attributesobject
    relationshipsobject
    links object
    property name* link
    oneOf
    string

    a string containing the link's URL

    meta object
    property name*any
  • ]
  • links object

    Link members related to primary data

    first object
    oneOf
    string

    a string containing the link's URL

    last object
    oneOf
    string

    a string containing the link's URL

    prev object
    oneOf
    string

    a string containing the link's URL

    next object
    oneOf
    string

    a string containing the link's URL

    property name* link
    oneOf
    string

    a string containing the link's URL

    jsonapi object

    The server's implementation

    versionstring
    meta object
    property name*any

Authorization: http

name: bearerTokentype: httpscheme: bearerin: headerdescription: Authorization Header: `Authorization: Bearer <user_token>`
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://apis.<domain>/resources/resources/typeOneResources/:id/relationships/:related_field/");
request.Headers.Add("Accept", "application/vnd.api+json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {}\n}", null, "application/vnd.api+json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://apis.<domain>/resources
Auth
Parameters
— pathrequired
— pathrequired
Body
{
  "data": {}
}