File Relationships

Create File Relationship(s)

POST https://api.moltin.com/v2/products/:productId/relationships/files

Create a product relationship to one or more Files. If any relationships already exist, the one's made in the request will be added to them.

Path Parameters

NameTypeDescription

productId

string

The ID of the product you wish to relate to the file(s).

Headers

NameTypeDescription

Authorization

string

The Bearer used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be file).

data[].id

string

The ID of the file.

{
    "data": [
        {
            "type": "file",
            "id": "2c51711-35f9-403e-aa73-8e6c80c2258b"
        },
        {
          "type": "file",
          "id": "2C090e3c8-0206-4243-9a3b-f28175f7e9de"
        }
    ]
}
curl -X "POST" https://api.moltin.com/v2/products/:productId/relationships/files \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "file",
          "id": "82c51711-35f9-403e-aa73-8e6c80c2258b"
        },
        {
          "type": "file",
          "id": "c090e3c8-0206-4243-9a3b-f28175f7e9de"
        }
      ]
    }'

Update File Relationship(s)

PUT https://api.moltin.com/v2/products/:productId/relationships/file

Replace the relationships between a Product and a File. Unlike a POST to this endpoint, a PUT overrides any existing relationships.

Path Parameters

NameTypeDescription

productId

string

The ID of the product you wish to relate to the file(s).

Headers

NameTypeDescription

Authorization

string

The Bearer token used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be file).

data[].id

string

The ID of the file.

{
    "data": [
        {
            "type": "file",
            "id": "2c51711-35f9-403e-aa73-8e6c80c2258b"
        }
}
curl -X "PUT" https://api.moltin.com/v2/products/:productId/relationships/files \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "file",
          "id": "82c51711-35f9-403e-aa73-8e6c80c2258b"
        }
      ]
    }

Delete File Relationships(s)

DELETE https://api.moltin.com/v2/products/:productId/relationships/file

Remove a relationship between a Product and File(s). This deletes the relationships specified in the payload.

Path Parameters

NameTypeDescription

productId

string

The ID of the product you wish to delete the relationship with file(s).

Headers

NameTypeDescription

Authorization

string

The Bearer used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be file).

data[].id

string

The ID of the file.

curl -X "DELETE" https://api.moltin.com/v2/products/:productId/relationships/files \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "file",
          "id": "82c51711-35f9-403e-aa73-8e6c80c2258b"
        }
      ]
    }'

Last updated