Version: 1.0.0

Users

Potion is a social API and users are the core feature of your incoming network. The User entry will allow you to create, edit and delete users from your database


Create a user

To create a user you have to make a HTTP POST request with parameters in JSON form. There are some required parameters for this operation:

  • first_name string
  • last_name string
  • nickname string: Must be unique, see Nickname availability
  • email string: Must be unique, api will send error code A user already exist with that email if already taken
  • password string: Must match your security requirement, see Advanced configuration
  • accept_conditions boolean: Must be true in order to be stored for GDPR consentment informations
  • accept_confidentiality boolean: Mmust be true in order to be stored for GDPR consentment informations

You can also pass more data, please refer to User's creationAPI to see all the available fields.

You also can pass those parameters as form-data instead of JSON.

Make sure to give your ApiTokenAPI and ApiSecretAPI as header in the HTTP request

curl -X POST \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/users \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"first_name": "Hello World !",
"last_name": "User",
"nickname": "JohnDoe666",
"email": "johndoe@protonmail.com",
"password": "h4x0R_@R3_l33T",
"accept_conditions": "true",
"accept_confidentiality": "true"
}'

Retrieve user unique ID

Congratulation, your user is now created, you must have received this kind of response from the API:

{
...
"slug":"johndoe",
"id":"7897f877a6eded28a6166340b191a896c9d67dbf",
"fullname":"JohnDoe",
"name":"JohnDoe",
"nickname":"JohnDoe",
...
}

Notice the id field form the answer ? It is your user unique ID, this ID will be used for whatever API operation you want to perform with this user, most of the times you will be asked for owner_id, this is this number we are asking for if you want to associate this user to a content.

List all users

Once some users were created, you will most of the time need to display them. You can gather them with an HTTP GET request.

Some filtering parameters are available, like pagination, per role, by nickname... please refer to User's listingAPI.

curl -X GET \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/users \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \

Users list response

Users listing are represented in a way to make your pagination easy. You will have a total_items key to help you for your pagination and also to give you the total users informations. All your users are inside a items key. A typical users listing response will look like this :

{
"items":[
{
"id":"7897f877a6eded28a6166340b191a896c9d67dbf",
"nickname":"JohnDoe",
...
},
{
"id":"ae31828c3e7d4c3482cd4fcf11a0ccc1",
"nickname":"JeanDupont",
...
}
],
"total_items":2
}