Create Destination
To create the data in the specified collection with the specified parameters. When a JSON object is saved, the object properties are automatically added to the collection you specified.
Method : POST
URL : /api/destination
Body : JSON
{
"name": "New Destination",
"image_url": "https://images.unsplash.com/photo-1682687220063-4742bd7fd538?auto=format&fit=crop&q=60&w=500",
"header_image_url": "https://images.unsplash.com/photo-1682687220063-4742bd7fd538?auto=format&fit=crop&q=60&w=500",
"description": "Destination Description",
"content": "Destination Content",
"video_url": "https://youtu.be/_IzOqfrLc0o",
"location": "Destination Location",
"island_id": 1,
"province_id": 1,
"category": [
{
"value": 1
},
{
"value": 2
}
],
"latlng": [-2.3723687086440504, 113.11523437500001]
}
name*Required
string
Destination name.
image_url*Required
string
Destination image URL
description*Required
string
Destination Description. Minimum Length 80
content*Required
string
Destination Content. Minimum Length 100
header_image_url
string
Destination header image URL
video_url
string
Destination video URL.
location
string
Destination location.
island_id
number
Destination island ID.
province_id
number
Destination province ID.
latlng
array of double
Destination latitude and longtitude.
[latitude (-2.372), longtitude (113.115)]
category
array of object
Destination category.
[
{
"value": ID of category (1)
},
{
"value": ID of category (2)
}
]
Response : 200 - OK
{
"message": "Success add Destination"
}
Response : 422 - Unprocessable Content
{
"error": [
{
"code": "too_small",
"minimum": 1,
"type": "string",
"inclusive": true,
"exact": false,
"message": "Name is required",
"path": [
"name"
]
},
{
"code": "too_small",
"minimum": 1,
"type": "string",
"inclusive": true,
"exact": false,
"message": "Image URL is required",
"path": [
"image_url"
]
},
{
"code": "too_small",
"minimum": 80,
"type": "string",
"inclusive": true,
"exact": false,
"message": "Description is required",
"path": [
"description"
]
},
{
"code": "too_small",
"minimum": 100,
"type": "string",
"inclusive": true,
"exact": false,
"message": "Content is required",
"path": [
"content"
]
}
]
}
Response : 500 - Server Error
Internal Server Error