Flavours API
Country

Create Country

POST
/api/v2/countries

Create a new country 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

flag*string

Country flag emoji. Must not be greater than 8 characters.

name*string

Country name.

currency*string

Country currency code. Must not be greater than 16 characters.

phone_prefix*number

Phone number prefix.

phone_start?|

Phone number start digits.

phone_max?|

Maximum phone number digits.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:8000/api/v2/countries" \  -H "X-API-Version: 2.3.0" \  -H "Content-Type: application/json" \  -d '{    "flag": "🇸🇦",    "name": "Saudi Arabia",    "currency": "SAR",    "phone_prefix": 966  }'
{
  "meta": {
    "code": 200,
    "status": "success",
    "message": "Create Success"
  },
  "data": {
    "flag": "🇲🇦",
    "name": "Morocco",
    "currency": "MAD",
    "phone_prefix": "212",
    "phone_start": "1",
    "phone_max": 10,
    "id": 16
  }
}
{
  "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 flag must not be greater than 8 characters. (and 4 more errors)"
  },
  "data": [
    {
      "code": 0,
      "message": "The flag must not be greater than 8 characters.",
      "field": "flag"
    },
    {
      "code": 0,
      "message": "The name field is required.",
      "field": "name"
    },
    {
      "code": 0,
      "message": "The currency must not be greater than 16 characters.",
      "field": "currency"
    },
    {
      "code": 0,
      "message": "The phone prefix must be a number.",
      "field": "phone_prefix"
    },
    {
      "code": 0,
      "message": "The phone prefix field must not have more than 3 digits.",
      "field": "phone_prefix"
    }
  ]
}
{
  "meta": {
    "code": 500,
    "status": "error",
    "message": "Internal server error."
  },
  "data": null
}