Door Control Service

Door Control Service lets your application remotely lock or unlock vehicle doors using the Ekko GraphQL API.

Prerequisites

Before you begin, make sure you have:

  • Signed up at connect.munic.io.
  • A valid Bearer token in the Authorization header.
  • The deviceId of the target vehicle and permissions to control it.
  • A vehicle that supports door control (capability may vary by model).

Lock or Unlock Doors

Using the doorToggle mutation

Lock or Unlock Doors
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
"""
Variables:
 
{
  "deviceId": "12345",
  "action": "UNLOCK"
}

"""
mutation doorToggle($deviceId: ID!, $action: DoorAction!) {
  doorToggle(deviceId: $deviceId, action: $action) {
    id
    type
    attributes
  }
}
1
2
3
4
5
6
export TOKEN=<YOUR_MUNIC_CONNECT_TOKEN>

curl --request POST 'https://api.munic.io/services/ekko/v2/graphql' \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/json" \
--data '{"query": "mutation doorToggle($deviceId: ID!, $action: DoorAction!) {\n  doorToggle(deviceId: $deviceId, action: $action) {\n    id\n    type\n    attributes\n  }\n}", "variables":{  "deviceId": "12345",  "action": "UNLOCK"}}'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import requests

token = <YOUR_MUNIC_CONNECT_TOKEN>
url = "https://api.munic.io/services/ekko/v2/graphql"

payload = """
{"query": "mutation doorToggle($deviceId: ID!, $action: DoorAction!) {
  doorToggle(deviceId: $deviceId, action: $action) {
    id
    type
    attributes
  }
}", "variables":
{
  "deviceId": "12345",
  "action": "UNLOCK"
}
}
"""

payload = payload.replace("\n", "")

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer %s'%(token)
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
See JSON Answer
{
  "data": {
    "doorToggle": {
      "id": "987654321",
      "type": "RDC_ASYNC_ACK",
      "attributes": {
        "status": "QUEUED"
      }
    }
  }
}
Asynchronous Command

doorToggle returns an asynchronous acknowledgement (RdcAsyncAck). The command is sent to the vehicle, but the physical lock status may update a few seconds later. Use the status query below to confirm the final state.

Compatibility and Permissions

Door control availability depends on the vehicle and embedded system configuration. Make sure your account has the required permissions for the target device.

DoorAction values

ValueDescription
LOCKLock all vehicle doors
UNLOCKUnlock all vehicle doors

Backend cURL example

curl -X POST "https://api.munic.io/services/ekko/v2/graphql" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{"query":"mutation doorToggle($deviceId: ID!, $action: DoorAction!) { doorToggle(deviceId: $deviceId, action: $action) { id type attributes } }","variables":{"deviceId":"12345","action":"LOCK"}}'

Check Door Status

Query the vehicle

Get Door Lock Status
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
"""
Variables:
 
{
  "id": "12345"
}

"""
query getDoorLockStatus($id: ID!) {
  vehicle(id: $id) {
    doorsLockStatus
    doorsLockStatusUpdatedAt
  }
}
1
2
3
4
5
6
export TOKEN=<YOUR_MUNIC_CONNECT_TOKEN>

curl --request POST 'https://api.munic.io/services/ekko/v2/graphql' \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/json" \
--data '{"query": "query getDoorLockStatus($id: ID!) {\n  vehicle(id: $id) {\n    doorsLockStatus\n    doorsLockStatusUpdatedAt\n  }\n}", "variables":{  "id": "12345"}}'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import requests

token = <YOUR_MUNIC_CONNECT_TOKEN>
url = "https://api.munic.io/services/ekko/v2/graphql"

payload = """
{"query": "query getDoorLockStatus($id: ID!) {
  vehicle(id: $id) {
    doorsLockStatus
    doorsLockStatusUpdatedAt
  }
}", "variables":
{
  "id": "12345"
}
}
"""

payload = payload.replace("\n", "")

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer %s'%(token)
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
See JSON Answer
{
  "data": {
    "vehicle": {
      "doorsLockStatus": "UNLOCKED",
      "doorsLockStatusUpdatedAt": "2023-10-27T10:00:00Z"
    }
  }
}

DoorsLockStatus values

ValueDescription
UNKNOWNStatus not available
LOCKEDDoors are locked
UNLOCKEDDoors are unlocked

API Reference