Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

API Reference

Jannik Emmerich edited this page Nov 11, 2020 · 5 revisions

User Endpoints

/name

Get Information About a Network by its Name

Required parameters:

  • name: name of the network [string]

Response:

  • success:
{
  "uuid":"<uuid of the network [string, UUID]>",
  "hidden":"<visibility of the network [boolean]>",
  "owner":"<uuid of the owner of the network [string, UUID]>",
  "name":"<name of the network [string]>"
}
  • the network does not exist:
{
  "error":"network_not_found"
}

/get

Get Information About a Network by its UUID

Required parameters:

  • uuid: uuid of the network [string, UUID]

Response:

  • success:
{
  "uuid":"<uuid of the network [string, UUID]>",
  "hidden":"<visibility of the network [boolean]>",
  "owner":"<uuid of the owner of the network [string, UUID]>",
  "name":"<name of the network [string]>"
}
  • the network does not exist:
{
  "error":"network_not_found"
}

/public

Get a List of All Public Networks

No parameters

Response:

  • success:
{
  "networks": 
    [{
      "uuid":"<uuid of the network [string, UUID]>",
      "hidden":"<visibility of the network [boolean]>",
      "owner":"<uuid of the owner of the network [string, UUID]>",
      "name":"<name of the network [string]>"
    }]
}

/create

Create a New Network

Required parameters:

  • device: uuid of the device that wants to create a new network [string, UUID]
  • name: name of the new network [string]
  • hidden: visibility of the new network [boolean]

Response:

  • success:
{
  "uuid":"<uuid of the network [string, UUID]>",
  "hidden":"<visibility of the network [boolean]>",
  "owner":"<uuid of the owner of the network [string, UUID]>",
  "name":"<name of the network [string]>"
}
  • the device is owner of more than two networks:
{
  "error":"maximum_networks_reached"
}
  • the name is not valid:
{
  "error":"invalid_name"
}
  • the name is already in use:
{
  "error":"name_already_in_use"
}
  • the user has no permissions for the device:
{
  "error":"no_permissions"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/members

Get All Members of a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]

Response:

  • success:
{
  "members":
    [{
      "uuid":"<uuid of the membership [string, UUID]>",
      "network":"<uuid of the network [string, UUID]>",
      "device":"<uuid of the device [string, UUID]>"
    }]
}
  • the network does not exist or the user has no permissions for the owner device of the network:
{
  "error":"network_not_found"
}

/member

Get All Network of a Device

Required parameters:

  • device: uuid of the device [string, UUID]

Response:

  • success:
{
  "networks":
    [{
      "uuid":"<uuid of the network [string, UUID]>",
      "hidden":"<visibility of the network [boolean]>",
      "owner":"<uuid of the owner of the network [string, UUID]>",
      "name":"<name of the network [string]>"
    }]
}

/request

Request by a Device to Join a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]
  • device: uuid of the device [string, UUID]

Response:

  • success:
{
  "uuid":"<uuid of the invitation [string, UUID]>",
  "network":"<uuid of the network [string, UUID]>",
  "device":"<uuid of the device [string, UUID]>",
  "request":true
}
  • the network does not exist:
{
  "error":"network_not_found"
}
  • the device is already member of the network:
{
  "error":"already_member_of_network"
}
  • the device has already been invited to the network or has already requestd to join the network:
{
  "error":"invitation_already_exists"
}
  • the user has no permissions for the device:
{
  "error":"no_permissions"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/invitations

Get All Invitations of a Device

Required parameters:

  • device: uuid of the device [string, UUID]

Response:

  • success:
{
  "invitations":
    [{
      "uuid":"<uuid of the invitation [string, UUID]>",
      "network":"<uuid of the network [string, UUID]>",
      "device":"<uuid of the device [string, UUID]>",
      "request":"<invitation is request or invitation [boolean]>"
    }]
}
  • the user has no permissions for the device:
{
  "error":"no_permissions"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/leave

Leave a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]
  • device: uuid of the device [string, UUID]

Response:

  • success:
{
  "result":true
}
  • the user has no permissions for the device or the network does not exist:
{
  "error":"no_permissions"
}
  • the device is not a member of the network:
{
  "result":false
}
  • the device is the owner of the network:
{
  "error":"cannot_leave_own_network"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/owner

Get All Networks Where the Device is the Owner

Required parameters:

  • device: uuid of the device [string, UUID]

Response:

  • success:
{
  "networks":
    [{
      "uuid":"<uuid of the network [string, UUID]>",
      "hidden":"<visibility of the network [boolean]>",
      "owner":"<uuid of the owner of the network [string, UUID]>",
      "name":"<name of the network [string]>"
    }]
}

/invite

Invite a Device to Join a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]
  • device: uuid of the device [string, UUID]

Response:

  • success:
{
  "uuid":"<uuid of the invitation [string, UUID]>",
  "network":"<uuid of the network [string, UUID]>",
  "device":"<uuid of the device [string, UUID]>",
  "request":false
}
  • the network does not exist or the user has no permissions for the owner device of the network:
{
  "error":"network_not_found"
}
  • the device is already member of the network:
{
  "error":"already_member_of_network"
}
  • the device has already been invited to the network or has already requestd to join the network:
{
  "error":"invitation_already_exists"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/accept

Accept an Invitation/Request

Required parameters:

  • uuid: uuid of the invitation [string, UUID]

Response:

  • success:
{
  "result":true
}
  • the invitation does not exist:
{
  "error":"invitation_not_found"
}
  • the user has no permissions to accept the invitation:
{
  "error":"no_permissions"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/deny

Deny an Invitation/Request

Required parameters:

  • uuid: uuid of the invitation [string, UUID]

Response:

  • success:
{
  "result":true
}
  • the invitation does not exist:
{
  "error":"invitation_not_found"
}
  • the user has no permissions to deny the invitation:
{
  "error":"no_permissions"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/requests

Get All Requests to a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]

Response:

  • success:
{
  "requests":
    [{
      "uuid":"<uuid of the invitation [string, UUID]>",
      "network":"<uuid of the network [string, UUID]>",
      "device":"<uuid of the device [string, UUID]>",
      "request":true
    }]
}
  • the network does not exist or the user has no permissions for the owner device of the network:
{
  "error":"no_permissions"
}

/invitations/network

Get All Invitations to a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]

Response:

  • success:
{
  "invitations":
    [{
      "uuid":"<uuid of the invitation [string, UUID]>",
      "network":"<uuid of the network [string, UUID]>",
      "device":"<uuid of the device [string, UUID]>",
      "request":false
    }]
}
  • the network does not exist or the user has no permissions for the owner device of the network:
{
  "error":"no_permissions"
}

/kick

Kick a Device Out of a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]
  • device: uuid of the device [string, UUID]

Response:

  • success:
{
  "result":true
}
  • the network does not exist or the user has no permissions for the owner device of the network:
{
  "error":"no_permissions"
}
  • the device is not a member of the network:
{
  "result":false
}
  • the device is the owner of the network:
{
  "error":"cannot_kick_owner"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/delete

Delete a Network

Required parameters:

  • uuid: uuid of the network [string, UUID]

Response:

  • success:
{
  "result":true
}
  • the network does not exist or the user has no permissions for the owner device of the network:
{
  "error":"network_not_found"
}
  • the device is not online:
{
  "error":"device_not_online"
}

/revoke

Revoke an Invitation/Request

Required parameters:

  • uuid: uuid of the invitation [string, UUID]

Response:

  • success:
{
  "result":true
}
  • the invitation does not exist:
{
  "error":"invitation_not_found"
}
  • the user has no permissions for the device of the invitation:
{
  "error":"no_permissions"
}
  • the device is not online:
{
  "error":"device_not_online"
}

MicroService Endpoints

/check

Check Whether Two Devices are in the Same Network

Required parameters:

  • source: uuid of the source device [string, UUID]
  • destination: uuid of destination device [string, UUID]

Response:

  • the two devices are in the same network:
{
  "connected":true
}
  • the two devices are not in the same network:
{
  "connected":false
}

/delete_user

Delete All Networks, Memberships and Invitation of the User

Required parameters:

  • user_uuid: uuid of the user [string, UUID]

Response:

  • success:
{}