Adds a course tag using POST.
Returns the tag. When a tag with that title already exists under that parent (and isn't deleted), that tag is returned (200) and no new one is made, so running an import twice doesn't make duplicates; a new tag gives 201.
For every API request you make, you'll need to present the API access key in the HTTP Header as X-API-Key to be authenticated.
| Name | Required | Value | Description |
|---|---|---|---|
| title | required | string | The tag's name, up to 255 characters |
| parent_id | optional | integer | A tag from GET /course-tags to put this tag under |
$request_url = 'https://api.frontcore.com/v2/course-tags';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-API-Key: {your-api-key}',
'Accept: application/json',
));
$result = curl_exec($ch);
curl_close($ch);
If the method is successful it responds with an JSON structure, as it is shown below.
{
"error": "Missing field(s): title"
}
Unsuccessful response sample:
{
"error": "Wrong API Key"
}