Creating a host
Create a host with the JSON format.
After logon, create a Host element in the JSON format with the following request:
POST http://localhost:8082/7.2.1/elements/host
Request body:
{
"name": "mySrc1",
"comment": "My SMC API's my Src Host 1",
"address": "192.168.0.13",
"secondary": ["10.0.0.156"]
}
The request returns a 201 HTTP response status code and the following in the Location HTTP header:
http://localhost:8082/7.2.1/elements/host/1704
See
createHostThenDeleteIt.py
JSON or XML samples.
The system prevents you from creating an element without a unique name.
If you try to create an element with an existing name, you receive a 404 HTTP error status code and the following error message:
{
"details":
[
"Element name fra-hide is already used."
],
"message": "Impossible to store the element fra-hide."
}