Skip to content

Fetch Promo Ads

Description

This API retrieves a list of promotional ads filtered by status and paginated using a cursor. The response includes promotional ads in either DRAFT or PUBLISHED status.

Endpoint

  • URL: /v1/promo-ads?status=DRAFT&cursor=2025-02-11T18:21:53Z&limit=1
  • Method: GET

Query Parameters:

ParameterTypeRequiredDescription
statusStringYesThe status of the promo ads (DRAFT or PUBLISHED).
cursorStringNoThe cursor for pagination. (2025-02-11T18:21:53Z&)
limitIntegerYesThe number of promo ads to retrieve (min: 1, max: 20).

Required Headers

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

Example API Call (Using Fetch)

javascript
fetch("https://api.shopsynch.com/v1/promo-ads?status=DRAFT&cursor=2025-02-11T18:21:53Z&limit=1", {
  method: "GET",
  headers: {
    "Authorization": "Bearer JWT_TOKEN",
    "X-MerchantApiKey": "MERCHANT_API_KEY",
    "Content-Type": "application/json"
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));

✅ Sample 200 Response (Success)

json
{
    "data": {
        "data": [
            {
                "id": "67abd011ea45dd1b9222e591",
                "adName": "Biggest Sale Ever",
                "images": [
                    "https://example.com/sale1.jpg",
                    "https://example.com/sale2.jpg"
                ],
                "ctaText": "Shop Now!",
                "promoCode": "BIGSALE50",
                "buttons": [
                    {
                        "type": "primary",
                        "position": "bottom-center",
                        "color": "#FF0000",
                        "textColor": "#FFFFFF",
                        "link": "https://example.com/shop",
                        "metadata": null
                    }
                ],
                "status": "DRAFT",
                "metadata": null,
                "createdAt": "2025-02-11T23:32:49.254",
                "updatedAt": "2025-02-11T23:32:49.254"
            }
        ],
        "nextCursor": "2025-02-11T18:21:53.148Z"
    },
    "message": "Promo Ads retrieved successfully",
    "status": true
}

Next Steps

Build with joy