Create a zone.

Details

Create a zone.

An account token, server token, or user token may be used to run this endpoint.

Parameters

body

  • environmentId (required): The ID of the environment.
  • meta (optional): The metadata associated with the zone.
  • alias (optional): The alias associated with the zone.
  • items (optional): The array of zone and device IDs that are contained inside the given zone.

header

  • x-system-metadata-prefix (optional): A customized metadata prefix. The default is “$.”

Responses

201

{
    "alias": "ZONE-ALIAS",
    "createdAt": "YYYY-MM-DD HH:MM:SS ENCODED",
    "ecosystemId": "ECOSYSTEM-ID",
    "environmentId": "ENVIRONMENT-ID",
    "id": "ZONE-ID",
    "meta": {}
}

400

  • Body Parameters Missing: The standard error structure defines this error as invalid parameters, and contains all required body parameters. If this error occurs when the JSON structure of the body parameters is syntactically correct, this means that the “content-type” header is incorrectly specified. The content-type header should be “application/json.”
  • Environment Invalid: The standard error structure defines this error as invalid parameters, with an invalid ID linked to the parameter that designates the environment ID. In this context, it means that the ID given for an environment was not valid.
  • Environment Missing: The standard error structure defines this error as invalid parameters. In this context, it means that the environment ID is missing, and was required.
  • No Query String Allowed: The standard error structure defines this error as invalid parameters, with additional parameters in the query string. In this context, it means that no query string is allowed at all when calling this endpoint.
  • Metadata Format Invalid: The standard error structure defines this error as invalid parameters. In this context, it means that metadata, when specified, should have been formatted as a valid JSON object, and it was not formatted that way.
  • Alias Invalid: The standard error structure defines this error as invalid parameters. The error means that an alias given for an object is not valid. However, this invalid alias does not necessarily mean that any other object references are invalid. This error refers only to the alias itself.
  • Alias Exists: The standard error structure defines this error as an invalid body. The error means that an object with the same alias already exists. The best way to avoid this error is to make sure all aliases are unique strings, regardless of where they are accessed from.

404

  • Environment Not Found: This error means that an environment with the given ID was not found. This is distinct from an invalid environment ID being specified; this means that the environment ID once existed, but no longer does.

Examples

HTTP

POST https://ioe.droplit.io/api/zones HTTP/1.1
authorization: TOKEN
content-type: application/json
{
    "environmentId": "ENVIRONMENT-ID"
}

Droplit Console

droplit zone create --environmentId ENVIRONMENT-ID

Droplit SDK

droplit.zones.create({
    "environmentId" : "ENVIRONMENT-ID",
    "meta" : {
        "$label" : "SDK Zone"
    },
    "alias" : "SDKZone",
    "items" : [   
        "DEVICE-ID",
        "ZONE-ID"
    ]
});
Language
Credentials
Header
Click Try It! to start a request and see the response here!