1. Home
  2. Docs
  3. API
  4. Examples

Examples

Here is a collection of examples of most used queries.

Remember that all queries are subjected to API ACL, and Permissions if the route is private.

YOUR-PROJECT-NAME in the url refers to your project name.

GET all

Request

GET https://x.apigoat.com/p/YOUR-PROJECT-NAME/api/v1/Authy HTTP/1.1
Content-type: application/json
Accept: application/json
Authorization: BEARER eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODI3NzYxMTIsImV4cCI6MTU4Mjc4MzMxMiwianRpIjoiM1R5NE1wQzM1THpmdmcxSTViRmhZdCIsInN1YiI6bnVsbCwic2NvcGUiOltdLCJ1c2VybmFtZSI6InN5c2FkbWluIiwiYXV0aHlJZCI6MSwiZ3JvdXAiOiJBZG1pbiIsImlzUm9vdCI6IlllcyJ9.jn9OZizJv9sgnta0sCgo9c72hENvbBIhRnc28wsKI6M

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
    {
      "id_user": 1,
      "username": "bob",
      "fullname": "",
      "passwd": "",
      "email": ""
    },
    {
      "id_user": 2,
      "username": "john",
      "fullname": "",
      "passwd": "",
      "email": ""
    }
  ],
  "status": "success",
  "count": 7
}

Set

Create

Request to create a new user

POST https://x.apigoat.com/p/YOUR-PROJECT-NAME/api/v1/Authy HTTP/1.1
Content-type: application/json
Accept: application/json
Authorization: BEARER eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODI3NzYxMTIsImV4cCI6MTU4Mjc4MzMxMiwianRpIjoiM1R5NE1wQzM1THpmdmcxSTViRmhZdCIsInN1YiI6bnVsbCwic2NvcGUiOltdLCJ1c2VybmFtZSI6InN5c2FkbWluIiwiYXV0aHlJZCI6MSwiZ3JvdXAiOiJBZG1pbiIsImlzUm9vdCI6IlllcyJ9.jn9OZizJv9sgnta0sCgo9c72hENvbBIhRnc28wsKI6M

{
    "username": "barney",
    "fullname": "",
    "password": "",
    "email": ""
}

Response

HTTP/1.1 201 CREATED
Content-Type: application/json

{
  "status": "success",
  "action": "Create User",
  "message": null,
  "ids": [8]
}

Update

Request to update a single user

POST https://x.apigoat.com/p/YOUR-PROJECT-NAME/api/v1/Authy HTTP/1.1
Content-type: application/json
Accept: application/json
Authorization: BEARER eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODI3NzYxMTIsImV4cCI6MTU4Mjc4MzMxMiwianRpIjoiM1R5NE1wQzM1THpmdmcxSTViRmhZdCIsInN1YiI6bnVsbCwic2NvcGUiOltdLCJ1c2VybmFtZSI6InN5c2FkbWluIiwiYXV0aHlJZCI6MSwiZ3JvdXAiOiJBZG1pbiIsImlzUm9vdCI6IlllcyJ9.jn9OZizJv9sgnta0sCgo9c72hENvbBIhRnc28wsKI6M

{
"id_user":"1",
"expire":null
}

Response

HTTP/1.1 201 Created
Content-Type: application/json

{
  "status": "success",
  "action": "Update User",
  "ids": [
    1
  ]
}

Request to update a multiple users, debug set to true

{
"query":{
        "filter":
            [["id_user", ["4", "5"]]
        ,
        "debug":true
    },
    "expire": "null"
}

Response

{
  "status": "success",
  "messages": null,
  "debug": {
    "query": "Criteria:\nSQL (may not be complete): SELECT  FROM `user` WHERE user.id_user IN (:p1,:p2)\nParams: user.id_user => '4', user.id_user => '5'"
  },
  "action": "Update User",
  "ids": [
    4,
    5
  ]
}

How can we help?

Leave a Reply