Flavours API
Banner

Create Banner

POST
/api/v2/banners

Create a new banner with the provided data.

AuthorizationBearer <token>

You can retrieve your token by logging in.

In: header

Header Parameters

X-API-Version*string

API contract version to target. See the Changelog for what changed in each version.

Default"2.0.0"
Value in"2.3.0" | "2.2.0" | "2.1.0" | "2.0.0"

Request Body

application/json

title_en*string

English title of the banner.

title_ar?|

Arabic title of the banner.

description_en*string

English description of the banner.

description_ar?|

Arabic description of the banner.

cover_img?|

URL of the cover image. Must be a valid URL.

button_url?|

URL for the call-to-action button. Must be a valid URL.

button_label_en?|

English label for the button.

button_label_ar?|

Arabic label for the button.

features*array<>

List of features associated with the banner. Must have at least 1 items.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:8000/api/v2/banners" \  -H "X-API-Version: 2.3.0" \  -H "Content-Type: application/json" \  -d '{    "title_en": "How to manage your inventory",    "description_en": "A comprehensive guide to tracking stock and suppliers.",    "features": [      {        "role": "USER_SUBSCRIBER",        "feature_key": "KITCHEN"      }    ]  }'
{
  "meta": {
    "code": 200,
    "status": "success",
    "message": "Create Success"
  },
  "data": {
    "id": "47c8a463-dcea-4ae1-a7f9-e26fa2f82992",
    "title_en": "Qui tempore odit iste.",
    "title_ar": "Reiciendis nulla ea.",
    "description_en": "Assumenda unde quia architecto vero accusantium et. Sit aut aliquid qui cum qui. Placeat doloribus aliquam labore et ipsa quisquam.",
    "description_ar": "Nulla id consequatur itaque aspernatur dolore ut eaque rerum. Et eius eum nihil.",
    "cover_img": "https://via.placeholder.com/640x480.png/00bbcc?text=ad",
    "button_url": "http://cartwright.com/quam-aspernatur-atque-dolore-odit-est-voluptas",
    "button_label_en": "Learn More",
    "button_label_ar": "اعرف المزيد",
    "created_at": 1782824832953,
    "updated_at": 1782824832953,
    "features": [
      {
        "id": "c131de0d-9166-4b11-ad92-1341f4f65a48",
        "banner_id": "47c8a463-dcea-4ae1-a7f9-e26fa2f82992",
        "role": "USER_SUBSCRIBER",
        "feature_key": "DEVICE",
        "feature": {
          "key": "DEVICE",
          "name_en": "Devices",
          "name_ar": "الأجهزة",
          "description_en": "Manage and configure connected devices.",
          "description_ar": "إدارة وتكوين الأجهزة المتصلة.",
          "roles": [
            "USER_SUBSCRIBER"
          ]
        }
      },
      {
        "id": "6a1afc91-fd55-4e90-81f5-ca198100a72a",
        "banner_id": "47c8a463-dcea-4ae1-a7f9-e26fa2f82992",
        "role": "USER_SUBSCRIBER",
        "feature_key": "ACCOUNT",
        "feature": {
          "key": "ACCOUNT",
          "name_en": "Accounts",
          "name_ar": "الحسابات",
          "description_en": "Access and manage account information.",
          "description_ar": "الوصول إلى معلومات الحساب وإدارتها.",
          "roles": [
            "USER_ADMIN",
            "USER_MERCHANT",
            "USER_SUBSCRIBER"
          ]
        }
      },
      {
        "id": "ffc1f418-f616-4268-adb6-3396838f0c0b",
        "banner_id": "47c8a463-dcea-4ae1-a7f9-e26fa2f82992",
        "role": "USER_SUBSCRIBER",
        "feature_key": "BRANCH",
        "feature": {
          "key": "BRANCH",
          "name_en": "Branches",
          "name_ar": "الفروع",
          "description_en": "Control and update branch information.",
          "description_ar": "التحكم وتحديث معلومات الفروع.",
          "roles": [
            "USER_SUBSCRIBER"
          ]
        }
      }
    ]
  }
}
{
  "meta": {
    "code": 401,
    "status": "error",
    "message": "Unauthenticated."
  },
  "data": null
}
{
  "meta": {
    "code": 403,
    "status": "error",
    "message": "Unauthorized."
  },
  "data": null
}
{
  "meta": {
    "code": 404,
    "status": "error",
    "message": "Resource not found."
  },
  "data": null
}
{
  "meta": {
    "code": 422,
    "status": "error",
    "message": "The title en field is required. (and 4 more errors)"
  },
  "data": [
    {
      "code": 0,
      "message": "The title en field is required.",
      "field": "title_en"
    },
    {
      "code": 0,
      "message": "The description en field is required.",
      "field": "description_en"
    },
    {
      "code": 0,
      "message": "The cover img must be a valid URL.",
      "field": "cover_img"
    },
    {
      "code": 0,
      "message": "The button url must be a valid URL.",
      "field": "button_url"
    },
    {
      "code": 0,
      "message": "The features field is required.",
      "field": "features"
    }
  ]
}
{
  "meta": {
    "code": 500,
    "status": "error",
    "message": "Internal server error."
  },
  "data": null
}