Composable Frontend 2.0 Learn more 

  • Commerce Cloud/
    Custom Data/
    Custom Data (Flows) API/
    Update Entry Relationships

    Update Entry Relationships

    PUT Update Entry Relationships

    https://useast.api.elasticpath.com/v2/flows/:flowSlug/entries/:entryId/relationships/:fieldSlug
    

    Replace the relationships between an entry and a resource. Unlike a POST to this endpoint, a PUT overrides any existing relationships.

    Parameters

    Path parameters

    NameRequiredTypeDescription
    fieldSlugRequiredstringThe slug of the field that the relationship belongs to.
    entryIdRequiredstringThe ID of the entry this field belongs to.
    flowSlugRequiredstringThe slug of the entry this flow belongs to.

    Headers

    NameRequiredTypeDescription
    AuthorizationRequiredstringThe Bearer token required to get access to the API.

    Body

    NameRequiredTypeDescription
    data.idOptionalstringThe ID of the related resource.
    data.typeOptionalstringRepresents the resource type of the object.
    dataOptionalobjectData to be stored.

    Request Examples

    Curl

    curl -X PUT https://useast.api.elasticpath.com/v2/flows/:flowSlug/entries/:entryId/relationships/:fieldSlug \
         -H "Authorization: Bearer XXXX" \
         -H "Content-Type: application/json" \
         -d $ {
          "data": [
        {
          "type": "brand",
          "id": "0d28e5b6-f615-4e1c-b038-275cfde97927"
        }
      ]
    }
    

    JavaScript SDK

    const flowSlug = "flow-slug";
    const entryId = "25617d3e-14a6-434c-bfab-3fda87517aaf";
    const fieldSlug = "field-slug";
    const data = {
        type: "brand",
        id: "0d28e5b6-f615-4e1c-b038-275cfde97927",
    };
    
    
    // Where `EPCC` is an authenticated client
    await EPCC.Flows.UpdateEntryRelationship(flowSlug, entryId, fieldSlug, data);
    

    Response Example

    200 OK

    {
        "data": [
            {
                "type": "brand",
                "id": "0d28e5b6-f615-4e1c-b038-275cfde97927"
            }
        ]
    }
    
    Previous
    Create an Entry Relationship