Composable Frontend 2.0 Learn more 

  • Products/
    Product Asset Relationships/
    Product Asset Relationships/
    Create Product-File Relationships

    Create Product-File Relationships

    This endpoint is for Administrator use only. Do not use this endpoint on your customer-facing frontends.

    POST Create Product-File Relationships

    https://useast.api.elasticpath.com/pcm/products/:productId/relationships/files
    

    A 409: Conflict response is returned when a record you are updating has been changed by another user at the same time.

    Parameters

    Path parameters

    NameRequiredTypeDescription
    productIdRequiredstringThe unique identifier of the product.

    Headers

    NameRequiredTypeDescription
    AuthorizationRequiredstringThe Bearer token to grant access to the API.

    Body

    NameRequiredTypeDescription
    typeRequiredstringThe type of the resource object. You must use file.
    idRequiredstringThe unique identifier of the file.

    This request creates relationships between the specified product and the files. The files are appended to the list of related files. Duplicate files are ignored.

    Request Example

    curl -X POST https://useast.api.elasticpath.com/pcm/products/14e055d0-eebb-4090-8594-a0a7aeea2151/relationships/files \
         -H "Authorization: Bearer XXXX" \
         -H "Content-Type: application/json" \
         -d $'{
            "data": [
                {
                "type": "file",
                "id": "string"
                }
            ]
         }'
    

    Response Example

    201 Created

    Previous
    Get Product-File Relationships