Amadis

Administration APIs - User

Define a new user

This API allows registering a user:

Verb

POST

Resource

/api/user/v1/register

Content type

application/x-www-form-urlencoded

Body

name=<name>&

email=<email>&

password=<password>

Where:

Field

Description

name

The user name

email

The user email address

password

The user password

Response code

The expected response code is 201

Response data

The response data is a JSON object with the following structure:

{

Field

Description

 

“status”: “success”,

Request successful

 

“data”: {

Response data

 

“id”: <id>

Item ID in DB (int)

 

“user_id”: “<user Id>”

User ID (String)

 

“user_secret”:”<user secret>”

A base64 encoded 32 byte secret

 

}

 

}

 

 

Update a user password

This API allows to update an existing user password:

Verb

PATCH

Resource

/api/user/v1/changepassword

Content type

application/x-www-form-urlencoded

Arguments

email=<email>&

oldpassword=<old password>&

newpassword=<new password>

Where:

Field

Description

email

The user email address

oldpassword

The user current password

newpassword

The desired new user password

Response code

The expected response codes are:

  • 200: OK

  • 400: wrong old password

Response data

The response data is a JSON object with the following structure:

{

Field

Description

Mandatory / Optional

 

“status”: “success”,

Request successful

M

 

“data”: {

 

O

 

“error”: “<message>”

Error message

O

 

}

 

 

}

 

 

 

Reset a user password

This API allows resetting a user password (backend generated)

Verb

PATCH

Resource

/api/user/v1/resetpassword

Content type

application/x-www-form-urlencoded

Body

email=<email>

Where:

Field

Description

email

The user email address

Response code

The expected response code is 200

Response data

The response data is a JSON object with the following structure:

{

Field

Description

 

“status”: “success”,

Request successful

 

“data”: {

Response data

 

"email": "<email>",

The user email

 

"password": "<new password>”

The new generated password

 

}

 

}

 

 

GET all users or a specific one

This API allows retrieving the list of users:

Verb

GET

Resource

/api/datamanagement/v1/User(/{id})

Content type

application/x-www-form-urlencoded

Body

N/A

Response code

The expected response code is 200

Response data

The response data is a JSON object with the following structure:

{

Field

Description

 

“statusCode”: 200,

Request successful

 

“User”: [

User(s)

 

{

 

 

“id”: <user Id>

User ID (int)

 

"name": "<name>",

 

 

"email": "<email>",

 

 

"email_verified_at": null,

 

 

"password": "<password>",

Blowfish hashed

 

"remember_token": null,

 

 

"created_at": null,

 

 

"updated_at": null

 

 

},

 

 

….

 

 

]

 

}

 

 

PATCH a user

This API allows updating an existing user:

Verb

PATCH

Resource

/api/datamanagement/v1/User/{id}

Content type

application/json

Body

{

“data”: {

“name”: “…”,

}

}

Response code

The expected response code is 200

Response data

N/A

“password” cannot be changed using that route. Use /api/user/v1/changepassword or /api/user/v1/resetpassword instead.

DELETE a user

This API allows updating an existing user:

Verb

DELETE

Resource

/api/datamanagement/v1/User/{id}

Content type

application/x-www-form-urlencoded

Body

N/A

Response code

The expected response code is 200

Response data

N/A