# Create menu

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/menus/llms.txt.
> For full documentation content, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/menus/llms-full.txt.

POST http://localhost:8080/api/v1/menus
Content-Type: application/json

Create a new draft menu

Reference: https://apidocs.cata.sg/pos-integration-service-api/api/v-1/menus/create-menu

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/menus:
    post:
      operationId: create-menu
      summary: Create menu
      description: Create a new draft menu
      tags:
        - subpackage_api.subpackage_api/v1.subpackage_api/v1/menus
      parameters:
        - name: X-Api-Key
          in: header
          required: true
          schema:
            type: string
        - name: X-Tenant-ID
          in: header
          description: Tenant identifier
          required: false
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_v1_menus_Create menu_Response_201'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostApiV1MenusRequestBadRequestError'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                channelType:
                  type: string
                internalName:
                  type: string
                priority:
                  type: integer
                startDate:
                  type: string
                endDate:
                  type: string
              required:
                - name
                - channelType
                - internalName
                - priority
                - startDate
                - endDate
servers:
  - url: http://localhost:8080
components:
  schemas:
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoresItems:
      type: object
      properties:
        uuid:
          type: string
        name:
          type: string
      required:
        - uuid
        - name
      title: ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoresItems
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuOperatingHoursItems:
      type: object
      properties:
        weekday:
          type: integer
        startTime:
          type: string
        endTime:
          type: string
      required:
        - weekday
        - startTime
        - endTime
      title: >-
        ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuOperatingHoursItems
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey0Items:
      type: object
      properties:
        weekday:
          type: integer
        startTime:
          type: string
        endTime:
          type: string
      required:
        - weekday
        - startTime
        - endTime
      title: >-
        ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey0Items
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey1Items:
      type: object
      properties:
        weekday:
          type: integer
        startTime:
          type: string
        endTime:
          type: string
      required:
        - weekday
        - startTime
        - endTime
      title: >-
        ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey1Items
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHours:
      type: object
      properties:
        key_0:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey0Items
        key_1:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey1Items
      required:
        - key_0
        - key_1
      title: >-
        ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHours
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuGroupsItems:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        sortNum:
          type: integer
      required:
        - id
        - name
        - sortNum
      title: ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuGroupsItems
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuSectionsItemsItemsItems:
      type: object
      properties:
        id:
          type: integer
        itemId:
          type: integer
        itemCode:
          type: string
        name:
          type: string
        provider:
          type: string
        sortNum:
          type: integer
        visible:
          type: boolean
        basePrice:
          type: number
          format: double
        specialPrice:
          type: number
          format: double
        deletedAt:
          type: string
          format: date-time
      required:
        - id
        - itemId
        - itemCode
        - name
        - provider
        - sortNum
        - visible
        - basePrice
        - specialPrice
        - deletedAt
      title: >-
        ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuSectionsItemsItemsItems
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuSectionsItems:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        displayType:
          type: string
        sortNum:
          type: integer
        visible:
          type: boolean
        items:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuSectionsItemsItemsItems
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - name
        - description
        - displayType
        - sortNum
        - visible
        - items
        - createdAt
        - updatedAt
      title: ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuSectionsItems
    ApiV1MenusPostResponsesContentApplicationJsonSchemaMenu:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        internalName:
          type: string
        channelType:
          type: string
        priority:
          type: integer
        isPublishable:
          type: boolean
        warnings:
          type: array
          items:
            type: string
        storeCount:
          type: integer
        stores:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoresItems
        startDate:
          type: string
        endDate:
          type: string
        operatingHours:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuOperatingHoursItems
        storeOperatingHours:
          $ref: >-
            #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuStoreOperatingHours
        groups:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuGroupsItems
        sections:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenuSectionsItems
        createdAt:
          type: string
        updatedAt:
          type: string
        deletedAt:
          type: string
      required:
        - id
        - name
        - internalName
        - channelType
        - priority
        - isPublishable
        - warnings
        - storeCount
        - stores
        - startDate
        - endDate
        - operatingHours
        - storeOperatingHours
        - groups
        - sections
        - createdAt
        - updatedAt
        - deletedAt
      title: ApiV1MenusPostResponsesContentApplicationJsonSchemaMenu
    api_v1_menus_Create menu_Response_201:
      type: object
      properties:
        code:
          type: integer
        isSuccess:
          type: boolean
        message:
          type: string
        menu:
          $ref: >-
            #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaMenu
      required:
        - code
        - isSuccess
        - message
        - menu
      title: api_v1_menus_Create menu_Response_201
    ApiV1MenusPostResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        details:
          type: string
        field:
          type: string
      required:
        - code
        - message
        - details
        - field
      title: ApiV1MenusPostResponsesContentApplicationJsonSchemaError
    PostApiV1MenusRequestBadRequestError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1MenusPostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1MenusRequestBadRequestError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

```

## SDK Code Examples

```python api_v1_menus_Create menu_example
import requests

url = "http://localhost:8080/api/v1/menus"

payload = {
    "name": "string",
    "channelType": "pickup_delivery",
    "internalName": "string",
    "priority": 6844,
    "startDate": "string",
    "endDate": "string"
}
headers = {
    "X-Tenant-ID": "string",
    "X-Api-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript api_v1_menus_Create menu_example
const url = 'http://localhost:8080/api/v1/menus';
const options = {
  method: 'POST',
  headers: {
    'X-Tenant-ID': 'string',
    'X-Api-Key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"string","channelType":"pickup_delivery","internalName":"string","priority":6844,"startDate":"string","endDate":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go api_v1_menus_Create menu_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v1/menus"

	payload := strings.NewReader("{\n  \"name\": \"string\",\n  \"channelType\": \"pickup_delivery\",\n  \"internalName\": \"string\",\n  \"priority\": 6844,\n  \"startDate\": \"string\",\n  \"endDate\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Tenant-ID", "string")
	req.Header.Add("X-Api-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby api_v1_menus_Create menu_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/menus")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = 'string'
request["X-Api-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"string\",\n  \"channelType\": \"pickup_delivery\",\n  \"internalName\": \"string\",\n  \"priority\": 6844,\n  \"startDate\": \"string\",\n  \"endDate\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java api_v1_menus_Create menu_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/menus")
  .header("X-Tenant-ID", "string")
  .header("X-Api-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"string\",\n  \"channelType\": \"pickup_delivery\",\n  \"internalName\": \"string\",\n  \"priority\": 6844,\n  \"startDate\": \"string\",\n  \"endDate\": \"string\"\n}")
  .asString();
```

```php api_v1_menus_Create menu_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8080/api/v1/menus', [
  'body' => '{
  "name": "string",
  "channelType": "pickup_delivery",
  "internalName": "string",
  "priority": 6844,
  "startDate": "string",
  "endDate": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Api-Key' => '<apiKey>',
    'X-Tenant-ID' => 'string',
  ],
]);

echo $response->getBody();
```

```csharp api_v1_menus_Create menu_example
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/menus");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Tenant-ID", "string");
request.AddHeader("X-Api-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"string\",\n  \"channelType\": \"pickup_delivery\",\n  \"internalName\": \"string\",\n  \"priority\": 6844,\n  \"startDate\": \"string\",\n  \"endDate\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift api_v1_menus_Create menu_example
import Foundation

let headers = [
  "X-Tenant-ID": "string",
  "X-Api-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "string",
  "channelType": "pickup_delivery",
  "internalName": "string",
  "priority": 6844,
  "startDate": "string",
  "endDate": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/menus")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```