# Events API

<Aside type="note">
หากต้องการติดตาม events ที่ถูกกระตุ้นโดยผู้ใช้ ให้เรียกใช้เมธอด [/postEvent](/th/developer/api-reference/user-centric-api#postevent) จาก User Centric API
</Aside>

## createEvent

`POST` `https://api.pushwoosh.com/json/1.3/createEvent`

สร้าง Event สำหรับแอปพลิเคชัน

#### Request Body

| Name | Type | Description |
| --- | --- | --- |
| auth\* | string | [API access token](/th/developer/api-reference/api-identifiers/#api-access-token) จาก Pushwoosh Control Panel |
| application\* | string | [Pushwoosh application code](/th/developer/api-reference/api-identifiers/#application-code) |
| name | string | ชื่อ Event สูงสุด 32 ตัวอักษร |
| description | string | คำอธิบาย Event สูงสุด 64 ตัวอักษร |
| eventAttributes | array | อาร์เรย์ของ Event attributes |
| trackRevenue | boolean | ดูส่วน Track Event Revenue |

<Tabs>
<TabItem label="200">
```
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "event": 351 // Created Event Id
  }
}
```
</TabItem>
</Tabs>

```
{
  "request": {
    "auth":"yxoPUlwqm…………pIyEX4H",     // required. API access token from Pushwoosh Control Panel
    "application": "XXXXX-XXXXX",      // required. Pushwoosh application code
    "name": "BasketOpen",              // required. 32 characters max. Event name. 
    "description": "Open basket page", // optional. 64 characters max. Event description. 
    "eventAttributes": [{              // optional. Event attributes array
      "type": 3,                       // Attribute type. Values:
                                       // 1 - integer;
                                       // 2 - string;
                                       // 3 - list;
                                       // 4 - date;
                                       // 5 - boolean;
                                       // 6 - price;
      "name": "products"               // 64 characters max. Attribute name 
    }, {
      "type": 5,
      "name": "delivery"
    }],
    "trackRevenue": false
  }
}
```

**Response:**

| | | |
| --- | --- | --- |
| 200 | 200 | สร้าง Event สำเร็จ |
| 200 | 210 | ข้อผิดพลาดของอาร์กิวเมนต์ ดู status\_message สำหรับข้อมูลเพิ่มเติม |
| 200 | 403 | ข้อผิดพลาดด้านสิทธิ์ (เช่น เมื่อเกินขีดจำกัด Events) |
| 200 | 404 | ไม่พบทรัพยากร |
| 400 | N/A | สตริงคำขอไม่ถูกต้อง (Malformed request string) |
| 500 | 500 | ข้อผิดพลาดภายใน |