Create a new host group
1 min
POST
https://openapi.sine.co/v1/api/hosts/groups
Header Parameters
- x-sine-team-idstring<uuid>requiredDescriptionFormatuuid
Body Parameters
- bodyobjectrequiredDescription
- namestringrequiredExampleDescription
- siteIdstring<uuid>ExampleDescriptionFormatuuid
Responses
201
- object
- idstring<uuid>requiredExampleFormatuuid
- namestringrequiredExampleDescription
- privateboolean
- siteobject
- idstring<uuid>Formatuuid
- namestringExample
400
- objectExamplesBadRequest:
{ "id": "BAD_REQUEST", "message": "The request is invalid" }HostGroupNameTaken:{ "id": "HOST_GROUP_NAME_TAKEN", "message": "A host group with this name already exists for this site or team" }- codestringrequired
- messagestringrequired
401
- objectExample
{ "code": "UNAUTHORIZED", "message": "Invalid authentication credentials" }- codestringExampleDescription
- messagestringExampleDescription
403
- objectExample
{ "code": "FORBIDDEN", "message": "You are not allowed to access this information" }- codestringExampleDescription
- messagestringExampleDescription
404
- objectExample
{ "code": "SITE_NOT_FOUND", "message": "SiteNotFoundError" }- codestringExampleDescription
- messagestringExampleDescription
424
- objectExample
{ "code": "CONSUMER_ERROR", "message": "Unexpected error while communicating with downstream service, please try again" }- codestringExampleDescription
- messagestringExampleDescription
429
- objectExample
{ "code": "RATE_LIMITED", "message": "API rate limit exceeded" }- codestringExampleDescription
- messagestringExampleDescription
500
- objectExample
{ "code": "INTERNAL_SERVER_ERROR", "message": "Something went wrong, please try again later" }- codestringExampleDescription
- messagestringExampleDescription
curl
curl --request POST \
--url https://openapi.sine.co/v1/api/hosts/groups \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-sine-team-id: string<uuid>' \
--data '{
"name": "Host Group Name"
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("x-sine-team-id", "string<uuid>");
var raw = JSON.stringify({
"name": "Host Group Name"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://openapi.sine.co/v1/api/hosts/groups", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
import json
url = "https://openapi.sine.co/v1/api/hosts/groups"
payload = json.dumps({
"name": "Host Group Name"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'x-sine-team-id': 'string<uuid>'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// OK - Host group has been created successfully
{
"id": "ecbc5ca7-d6e1-4133-90a0-e7070d993f18",
"name": "Host Group Name",
"private": false,
"site": {
"id": "",
"name": "Site Name"
}
}400
// Invalid request
{
"code": "",
"message": ""
}GENERATED
// Invalid request
{
"code": "",
"message": ""
}BadRequest
{
"id": "BAD_REQUEST",
"message": "The request is invalid"
}HostGroupNameTaken
{
"id": "HOST_GROUP_NAME_TAKEN",
"message": "A host group with this name already exists for this site or team"
}401
// Unauthorized
{
"code": "UNAUTHORIZED",
"message": "Invalid authentication credentials"
}403
// Forbidden
{
"code": "FORBIDDEN",
"message": "You are not allowed to access this information"
}404
// Resource not found
{
"code": "SITE_NOT_FOUND",
"message": "SiteNotFoundError"
}424
// Service dependency failed
{
"code": "CONSUMER_ERROR",
"message": "Unexpected error while communicating with downstream service, please try again"
}429
// Too many requests
{
"code": "RATE_LIMITED",
"message": "API rate limit exceeded"
}500
// Internal server error
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Something went wrong, please try again later"
}