Skip to content

Update Promo Ad

Description

This API allows store owners to update an existing promotional advertisement by its unique ID.

Endpoint

  • URL: /v1/promo-ads/{promoAdId}
  • Method: PATCH

Required Headers

json
{
  "Authorization": "Bearer JWT_TOKEN",
  "X-MerchantApiKey": "MERCHANT_API_KEY",
  "Content-Type": "application/json"
}

📥 Request Body

PromoAdRequest

Field NameTypeRequiredDescription
adNameStringYesThe name of the promotional ad (max: 100 characters).
imagesListYesA list of image URLs for the ad. At least one image is required.
ctaTextStringYesThe call-to-action (CTA) text for the ad.
promoCodeStringYesThe promotional code associated with the ad (max: 20 characters).
buttonsListYesA list of buttons associated with the ad. At least one button is required.
statusStringYesThe status of the ad (DRAFT or PUBLISHED).

ButtonRequest

Field NameTypeRequiredDescription
typeStringYesThe button type (e.g., primary, secondary).
positionStringYesThe position of the button (e.g., top-right, bottom-left).
colorStringYesThe background color of the button (hex or name).
textColorStringYesThe text color of the button (hex or name).
textStringYesThe text inside the button.
linkStringYesThe URL associated with the button.
metadataObjectNoAdditional metadata for the button.

Example API Call (Using Fetch)

javascript
fetch("https://api.shopsynch.com/v1/promo-ads/12345", {
  method: "PATCH",
  headers: {
    "Authorization": "Bearer JWT_TOKEN",
    "X-MerchantApiKey": "MERCHANT_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "adName": "Spring Sale",
    "images": ["https://example.com/image1.jpg", "https://example.com/image2.jpg"],
    "ctaText": "Shop Now!",
    "promoCode": "SPRING20",
    "buttons": [
      {
        "type": "primary",
        "position": "top-right",
        "color": "#FF5733",
        "textColor": "#FFFFFF",
        "link": "https://example.com/shop",
        "metadata": {}
      }
    ],
    "status": "PUBLISHED"
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));

✅ Sample 200 Response (Success)

json
{
  "status": true,
  "message": "Promo ad updated successfully",
  "data": {
    "id": "12345",
    "adName": "Spring Sale",
    "status": "PUBLISHED"
  }
}

❌ Sample 404 Response (Not Found Error)

json
{
  "status": false,
  "message": "Promo ad not found"
}

Next Steps

Build with joy