For the latest stable version, please use Unifly Services v4.7!

Create Operation Example

Here’s a basic example of how to create a new operation using curl:

#!/bin/bash

# Base variables
API_KEY="your-api-key-here"
BASE_URL="https://portal.demo.unifly.tech/api/gcs"
SERIAL_NUMBER="your-drone-serial-number"

# Create new operation
curl -X POST "${BASE_URL}/operations" \
     -H "apikey: ${API_KEY}" \
     -H "Content-Type: application/json" \
     -d '{
       "type": "Feature",
       "properties": {
         "description": "Roof inspection at the train station",
         "volume": {
           "start": "2024-01-23T10:00:00Z",
           "end": "2024-01-23T11:00:00Z",
           "maxAltitude": 120
         },
       "geometry": {
         "type": "Polygon",
         "coordinates": [[
           [4.401394, 51.217974],
           [4.401394, 51.218974],
           [4.402394, 51.218974],
           [4.402394, 51.217974],
           [4.401394, 51.217974]
         ]]
       }
     }' \
     -v

The -v flag enables verbose output, showing the full HTTP request and response including headers.

  • Replace your-api-key-here and your-drone-serial-number with your actual values

  • Adjust the operation time window in the volume object

  • Update coordinates in both markers and geometry to match your actual operation area

  • The operation area is defined as a GeoJSON polygon

Example response:

{
  "type": "Feature",
  "properties": {
    "operationId": "OP_123456",
    "operationStatus": "DRAFT",
    "description": "Roof inspection at the train station",
    "isInFlight": false,
    "isAllowedToTakeOff": false
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [4.401394, 51.217974],
      [4.401394, 51.218974],
      [4.402394, 51.218974],
      [4.402394, 51.217974],
      [4.401394, 51.217974]
    ]]
  }
}

The operation is created in DRAFT status. You’ll need to request acceptance and activation before flying.