Clients API

End-points

Action Method URL
List all clients GET /api/v1/clients

Object

{
  "id": 1,
  "name": "John Doe",
  "email": "john@example.com",
  "permissions": {
    "can_create_forms": true
  },
  "forms": [
    {
      "id": 1,
      "name": "Contact form",
      "identifier": "f0fa953743197019"
    }
  ]
}

List clients

curl -H 'Authorization: Bearer exampletoken' -X GET https://www.formbackend.com/api/v1/clients
[
  {
    "id": 1,
    "name": "John Doe",
    "email": "john@example.com",
    "permissions": {
      "can_create_forms": true
    },
    "forms": [
      {
        "id": 1,
        "name": "Contact form",
        "identifier": "f0fa953743197019"
      }
    ]
  }
]

Show client

curl -H 'Authorization: Bearer exampletoken' -X GET https://www.formbackend.com/api/v1/clients/1
[
  {
    "id": 1,
    "name": "John Doe",
    "email": "john@example.com",
    "permissions": {
      "can_create_forms": true
    },
    "forms": [
      {
        "id": 1,
        "name": "Contact form",
        "identifier": "f0fa953743197019"
      }
    ]
  }
]

Create client

curl -H 'Authorization: Bearer exampletoken' -X POST https://www.formbackend.com/api/v1/clients?client[name]=John Doe&client[email]=john@example.com&client[can_create_forms]=false&client[form_ids]=[12,42]
{
  "id": 2,
  "name": "John Doe",
  "email": "john@example.com",
  "permissions": {
      "can_create_forms": false
  },
  "forms": [12,42]
}

Delete client

curl -H 'Authorization: Bearer exampletoken' -X DELETE https://www.formbackend.com/api/v1/clients/2
{
  message: "Client has been deleted"
}