Method: POST
Endpoint: /api/addSpinTag
Parameter | Type | Required |
Description |
place_holder | string | Yes | A unique title for spintag |
word_list | coma seprated word list i.e(john,alex,david,james) | Yes | List of values for a spintag |
response | 0, 1 (default: 0) | No | Get full response of the operation |
Parameter | Type | Description |
status | JSON | Success or Error |
result | JSON | Result of the operation |
response | JSON | Output of the operation |
<?php
// Authentication
$api_token = 'API_KEY'; // Mumara API Key (can be found in Settings -> API Key)
$domain = 'http://www.anydomain.com'; // Your Mumara Domain Name
// API Endpoint
$endpoint = '/api/addSpinTag';
$params = [
'place_holder' => 'Test List via Api',
'word_list' => 'John Lee',
'response' => 1
];
// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Executing cURL
$output = curl_exec ($ch);
// Printing Output
echo "<pre>";
echo json_encode(json_decode($output),JSON_PRETTY_PRINT );
// Closing cURL
curl_close ($ch);
?>
{
"status": "success",
"result": "Success: Spintag has been successfully added.",
"response": {
"user_id": 2,
"place_holder": "first name",
"tag": "first_name",
"word_list": "John\r\nJames\r\nAlexa\r\nDavid",
"updated_at": "2020-10-13 10:32:50",
"created_at": "2020-10-13 10:32:50",
"id": 13
}
}
Status value of the success response will be "success"
{
"status": "error",
"result": {
"place_holder": [
"Error: Missing required parameter, place holder"
],
"word_list": [
"Error: Missing required parameter, word list"
]
}
}