GET /users

Returns paginated JSON data about users.

URL:
/users

Method:
GET

URL Parameters:

  • none

Data Parameters:

  • page=[integer]
  • count=[integer] number of items returned per page, defaults to 10, max 100

Success Response:
Code: 200 OK
Content: 

{
    "data": [
        {
            "id": 344747366,
            "firstname": "Gregory",
            "lastname": "Claeyssens",
            "email": "gregory@test.com"
        },
        {
            "id": 874992931,
            "firstname": "Brik",
            "lastname": "Demaeyer",
            "email": "brik@test.com"
        },
        {
            "id": 825276078,
            "firstname": "Valeri",
            "lastname": "Potchekailov",
            "email": "valeri@test.com"
        }
    ],
    "meta": {
        "pagination": {
            "total": 3,
            "count": 3,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Error Response:
Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

GET /users/{id}

Returns JSON data about a user.

URL:
/users/{id}

Method:
GET

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 344747366,
        "first_name": "Gregory",
        "last_name": "Claeyssens",
        "phone": "0485123456",
        "bio": null,
        "email": "gregory@test.com",
        "role": "admin",
        "profile_picture": {
            "data": {
                "url": "https://d2wvyaiai4v4wx.cloudfront.net/../image.jpg",
                "name": "image.jpg",
                "sizes": {
                    "regular": "https://d3hryyoxn74gk4.cloudfront.net/../image_800.jpg",
                    "large": "https://d3hryyoxn74gk4.cloudfront.net/../image_1000.jpg",
                    "full": "https://d3hryyoxn74gk4.cloudfront.net/../image_2000.jpg"
                }
            }
        }
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}

POST /users

Create a new user.

URL:
/users

Method:
POST

URL Parameters:

  • none

Data Parameters:

  • suppress_notification=[boolean] default false

Body (json):
role can be one of the following admin, author, guest

{  
   "firstname":"kevin",
   "lastname":"cornelissen",
   "email":"kevin@test.com",
   "phone": "0485123456",
   "bio":"Sales at Story Chief",
   "role": "admin",
   "message": "Message to be sent when notifying this user",
}

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 344561278,
        "first_name": "kevin",
        "last_name": "cornelissen",
        "phone": "0485123456",
        "bio": "Sales at Story Chief",
        "email": "kevin@test.com",
        "role": "admin",
        "profile_picture": [],
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 400 BAD REQUEST
Content: 

{ 
   "error":{  
      "message":"The given data failed to pass validation.",
      "status":400
   }
}

PUT /users/{id}

Updates an existing user.

URL:
/users/{id}

Method:
PUT

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Body (json): 

{  
   "firstname":"Kevin",
   "lastname":"Cornelissen",
   "bio":"Sales guru at Story Chief",
   "phone": "0485987654",
}

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 344561278,
        "firstname": "Kevin",
        "lastname": "Cornelissen",
        "phone": "0485987654",
        "bio": "Sales guru at Story Chief",
        "email": "kevin@test.com",
        "profile_picture": []
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 400 BAD REQUEST
Content: 

{ 
   "error":{  
      "message":"The given data failed to pass validation.",
      "status":400
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}

POST /users/{id}/image

Updates a user's profile picture.

URL:
/users/{id}/image

Method:
POST

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Body (multipart/form-data encoded): 

  • file=[image] required
    accepts png, jpg, gif, minimum 200px x 200px

Success Response:
Code: 200 OK
Content: 

{
    "data": {
        "id": 344561278,
        "firstname": "Kevin",
        "lastname": "Cornelissen",
        "phone": "0485987654",
        "bio": "Sales guru at Story Chief",
        "email": "kevin@test.com",
        "profile_picture": {
            "data": {
                "url": "https://d2wvyaiai4v4wx.cloudfront.net/../image.jpg",
                "name": "image.jpg",
                "sizes": {
                    "regular": "https://d3hryyoxn74gk4.cloudfront.net/../image_800.jpg",
                    "large": "https://d3hryyoxn74gk4.cloudfront.net/../image_1000.jpg",
                    "full": "https://d3hryyoxn74gk4.cloudfront.net/../image_2000.jpg"
                }
            }
        }
    }
}

Error Response: 

Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 400 BAD REQUEST
Content: 

{ 
   "error":{  
      "message":"The given data failed to pass validation.",
      "status":400
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}

DELETE /users/{id}

Delete an existing user.

URL:
/users/{id}

Method:
DELETE

URL Parameters:

  • id=[integer] required

Data Parameters:

  • none

Success Response:
Code: 200 OK

Error Response:
Code: 401 UNAUTHORIZED
Content: 

{ 
   "error":{  
      "message":"Unauthenticated.",
      "status":401
   }
}

Code: 404 NOT FOUND
Content: 

{ 
   "error":{  
      "message":"Not Found",
      "status":404
   }
}
Did this answer your question?