Table of Contents
This API allows to create, view, update, and delete trip extras.
Trip Extras Properties #
Attribute | Type | Description |
trip_extras_id | integer | Unique identifier for the object. ( Read-Only ) |
trip_extras_title | string | Title of the trip extras. |
trip_extras_status | string | Status of the trip extras. Only works if the status is published. |
trip_extras_author | integer | ID of the user. |
trip_extras_date | date | Created date of trip extras. |
trip_extras_date_gmt | date | Created date of trip extras in GTM. |
trip_extras_metas | array | Trip extras meta data. |
Trip Extras Metas
Attribute | Type | Description |
trip_extras_featured_image | integer | ID of media to be used as featured image. |
trip_extras_item_description | string | Description of the item. |
trip_extras_item_price | float | Price of the item. |
trip_extras_sale_price | float | Sale price of the item. |
trip_extras_is_required | string | Set ‘yes’ if required. |
trip_extras_unit | string | Unit of the item. |
trip_extras_gallery | string | ID’s of media to be used as gallery. |
Add Trip Extra #
This API helps to create trip extras.
POST
/wp-json/wptravel/v1/add-trip-extras
curl --location 'https://example.com/wp-json/wptravel/v1/add-trip-extras' \
--header 'Authorization: Basic <application-key>' \
--form 'trip_extras_title="Trekking Stick"' \
--form 'trip_extras_featured_image="48"' \
--form 'trip_extras_gallery[]="49"' \
--form 'trip_extras_gallery[]="50"' \
--form 'trip_extras_item_description="Quality trek stick"' \
--form 'trip_extras_item_price="20"' \
--form 'trip_extras_sale_price="19"' \
--form 'trip_extras_is_required="yes"' \
--form 'trip_extras_unit="pics"'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic <application-key>");
var formdata = new FormData();
formdata.append("trip_extras_title", "Trekking Stick");
formdata.append("trip_extras_featured_image", "48");
formdata.append("trip_extras_gallery[]", "49");
formdata.append("trip_extras_gallery[]", "50");
formdata.append("trip_extras_item_description", "Quality trek stick");
formdata.append("trip_extras_item_price", "20");
formdata.append("trip_extras_sale_price", "19");
formdata.append("trip_extras_is_required", "yes");
formdata.append("trip_extras_unit", "pics");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://example.com/wp-json/wptravel/v1/add-trip-extras", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$client = new Client();
$headers = [
'Authorization' => 'Basic <application-key>'
];
$options = [
'multipart' => [
[
'name' => 'trip_extras_title',
'contents' => 'Trekking Sticks'
],
[
'name' => 'trip_extras_featured_image',
'contents' => '48'
],
[
'name' => 'trip_extras_gallery[]',
'contents' => '49'
],
[
'name' => 'trip_extras_gallery[]',
'contents' => '50'
],
[
'name' => 'trip_extras_item_description',
'contents' => 'Quality trek stick'
],
[
'name' => 'trip_extras_item_price',
'contents' => '20'
],
[
'name' => 'trip_extras_sale_price',
'contents' => '19'
],
[
'name' => 'trip_extras_is_required',
'contents' => 'yes'
],
[
'name' => 'trip_extras_unit',
'contents' => 'pics'
]
]];
$request = new Request('POST', 'https://example.com/wp-json/wptravel/v1/add-trip-extras', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Update Trip Extra #
This API helps you to create trip extras.
POST
/wp-json/wptravel/v1/update-trip-extras/51
curl --location 'https://example.com/wp-json/wptravel/v1/update-trip-extras/51' \
--header 'Authorization: Basic <application-key>' \
--form 'trip_extras_title="Nike Jacketss"' \
--form 'trip_extras_gallery[]="48"' \
--form 'trip_extras_item_description="asdasdasdasdadasdad"' \
--form 'trip_extras_item_price="40"' \
--form 'trip_extras_sale_price="15"' \
--form 'trip_extras_is_required="yes"' \
--form 'trip_extras_unit="pac"' \
--form 'trip_extras_featured_image="50"' \
--form 'trip_extras_gallery[]="49"' \
--form 'trip_extras_gallery[]="50"'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic <application-key>");
var formdata = new FormData();
formdata.append("trip_extras_title", "Nike Jacketss");
formdata.append("trip_extras_gallery[]", "48");
formdata.append("trip_extras_item_description", "asdasdasdasdadasdad");
formdata.append("trip_extras_item_price", "40");
formdata.append("trip_extras_sale_price", "15");
formdata.append("trip_extras_is_required", "yes");
formdata.append("trip_extras_unit", "pac");
formdata.append("trip_extras_featured_image", "50");
formdata.append("trip_extras_gallery[]", "49");
formdata.append("trip_extras_gallery[]", "50");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://example.com/wp-json/wptravel/v1/update-trip-extras/51", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$client = new Client();
$headers = [
'Authorization' => 'Basic <application-key>'
];
$options = [
'multipart' => [
[
'name' => 'trip_extras_title',
'contents' => 'Nike Jacketss'
],
[
'name' => 'trip_extras_gallery[]',
'contents' => '48'
],
[
'name' => 'trip_extras_item_description',
'contents' => 'asdasdasdasdadasdad'
],
[
'name' => 'trip_extras_item_price',
'contents' => '40'
],
[
'name' => 'trip_extras_sale_price',
'contents' => '15'
],
[
'name' => 'trip_extras_is_required',
'contents' => 'yes'
],
[
'name' => 'trip_extras_unit',
'contents' => 'pac'
],
[
'name' => 'trip_extras_featured_image',
'contents' => '50'
],
[
'name' => 'trip_extras_gallery[]',
'contents' => '49'
],
[
'name' => 'trip_extras_gallery[]',
'contents' => '50'
]
]];
$request = new Request('POST', 'https://example.com/wp-json/wptravel/v1/update-trip-extras/51', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Delete Trip Extra #
This API helps to create trip extras.
DELETE
/wp-json/wptravel/v1/delete-trip-extras/51
curl --location --request DELETE 'https://example.com/wp-json/wptravel/v1/delete-trip-extras/51' \
--header 'Authorization: Basic <application-key>'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic <application-key>");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://example.com/wp-json/wptravel/v1/delete-trip-extras/51", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$client = new Client();
$headers = [
'Authorization' => 'Basic <application-key>'
];
$request = new Request('DELETE', 'https://example.com/wp-json/wptravel/v1/delete-trip-extras/51', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Get Trip Extra #
This API helps to get trip extras by ID.
GET
/wp-json/wptravel/v1/get-trip-extras/52
curl --location 'https://example.com/wp-json/wptravel/v1/get-trip-extras/52'
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://example.com/wp-json/wptravel/v1/get-trip-extras/52", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$client = new Client();
$request = new Request('GET', 'https://example.com/wp-json/wptravel/v1/get-trip-extras/52');
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
JSON Response
{
"trip_extras_id": 52,
"trip_extras_title": "Trekking Stick",
"trip_extras_status": "publish",
"trip_extras_author": "0",
"trip_extras_date": "2023-04-06 09:57:43",
"trip_extras_date_gmt": "2023-04-06 09:57:43",
"trip_extras_featured_image": "48",
"trip_extras_gallery": [
"49",
"50"
],
"trip_extras_metas": {
"extras_item_description": "",
"extras_item_price": "20",
"extras_item_sale_price": "19",
"extras_is_required": "yes",
"extras_item_unit": "pics"
}
}
Get All Trip Extras #
This API helps to get all trip extras.
GET
/wp-json/wptravel/v1/get-all-trip-extras
curl --location 'https://work.test/wp-json/wptravel/v1/get-all-trip-extras'
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://example.com/wp-json/wptravel/v1/get-all-trip-extras", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$client = new Client();
$request = new Request('GET', 'https://example.com/wp-json/wptravel/v1/get-all-trip-extras');
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
JSON Response
[
{
"trip_extras_id": 53,
"trip_extras_title": "Trekking Sticks",
"trip_extras_status": "publish",
"trip_extras_author": "0",
"trip_extras_date": "2023-04-06 10:07:19",
"trip_extras_date_gmt": "2023-04-06 10:07:19",
"trip_extras_featured_image": "48",
"trip_extras_gallery": [
"49",
"50"
],
"trip_extras_metas": {
"extras_item_description": "This is dexcription.",
"extras_item_price": "20",
"extras_item_sale_price": "19",
"extras_is_required": "yes",
"extras_item_unit": "pics"
}
},
{
"trip_extras_id": 52,
"trip_extras_title": "Trekking Stick",
"trip_extras_status": "publish",
"trip_extras_author": "0",
"trip_extras_date": "2023-04-06 09:57:43",
"trip_extras_date_gmt": "2023-04-06 09:57:43",
"trip_extras_featured_image": "48",
"trip_extras_gallery": [
"49",
"50"
],
"trip_extras_metas": {
"extras_item_description": "This is dexcription.",
"extras_item_price": "20",
"extras_item_sale_price": "19",
"extras_is_required": "yes",
"extras_item_unit": "pics"
}
}
]