Rebrand 2023 Learn more 

  • Products/
    Extending Products/
    Product Templates API/
    Update a Template

    Update a Template

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

    PUT Update a Template

    https://useast.api.elasticpath.com/v2/flows/:id
    

    Parameters

    Path parameters

    NameRequiredTypeDescription
    idRequiredstringSpecifies the ID for the template that you want to update.

    Headers

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

    Body

    NameRequiredTypeDescription
    typeRequiredstringSpecifies the type of the resource. You must use flow.
    nameRequiredstringSpecifies the name of the template.
    slugRequiredstringSpecifies the unique slug identifier for the template. You must use the products(my-template-slug) format. For example, products(Skincare).
    descriptionRequiredstringProvides a description for the template.
    enabledRequiredbooleanSpecifies whether the template is enabled. Set this parameter true to assign the template to an attribute.

    Request Examples

    Curl

    curl -X POST "https://useast.api.elasticpath.com/v2/flows/:id" \
         -H "Authorization: XXXX" \
         -H "Content-Type: application/json" \
         -d $'{
            "data": {
                "id": "{FLOW_ID}",
                "type": "flow",
                "name": "products(Skincare)",
                "slug": "products(Skincare)",
                "description": "Description updated",
                "enabled": true
            }
         }'
    

    JavaScript SDK

    const MoltinGateway = require("@moltin/sdk").gateway;
    const Moltin = MoltinGateway({
        client_id: "X",
    });
    const flowId = "XXX";
    const data = {
        name: "products(Skincare)",
        slug: "products(Skincare)",
        description: "Description updated",
    };
    Moltin.Flows.Update(flowId, data).then((flow) => {
        // Do something
    });
    

    Response Example

    200 OK

    {
        "data": {
            "id": "6d320b42-237d-4474-8452-d49f884d4ae1",
            "type": "flow",
            "name": "extraFieldRenamed",
            "slug": "products-1",
            "description": "Description updated",
            "enabled": true,
            "links": {
                "self": "https://useast.api.elasticpath.com/v2/flows/6d320b42-237d-4474-8452-d49f884d4ae1"
            },
            "relationships": {},
            "meta": {
                "owner": "organization",
                "timestamps": {
                    "created_at": "2018-05-10T18:04:26.623Z",
                    "updated_at": "2018-05-10T18:11:47.469Z"
                }
            }
        }
    }
    
    Previous
    Create a Template