Version: 1.0.0

Pages

Like we've said before, page allow you to gather users or content around a sub entity on your network. Let's see how to create, edit or delete pages.


Page creation

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

  • name string: The page name
  • page_configuration_id integer : Relate to a page configuration you have created, see Page configuration for more informations)
  • privacy string: Will define the page privacy access, see Page privacy for more informations. Value can be public, private or secret.
  • user_id integer: Relate to the user unique id.

You can also pass more data, please refer to Page 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/pages \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"name": "My first page !!",
"description": "This a really beautiful page",
"page_configuration_id": "1",
"privacy": "public",
"user_id": "YOUR_USER_UNIQUE_ID"
}'

Retrieve page unique ID

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

{
...
"slug":"my-first-page",
"id": 1,
"name": "My first page",
...
}

Notice the id field form the answer ? It is your page unique ID, this ID will be used for whatever API operation you want to perform with this page, 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 page to a content.

Get pages list

You may want to display all your pages, for example, list them for your users in order for them to follow page of their choice. You can gather them with an HTTP GET request.

Some filtering parameters are available, like pagination, per page_configuration_id, by owner, by privacy... please refer to Pages's listingAPI for more informations.

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

Page list response

Pages 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 pages informations. All your pages are inside a items key. A typical pages listing response will look like this :

{
"items":[
{
"id":"2e8dd42ac25c473e958ec49799e43cf4",
"name":"My First User",
"slug":"my-first-page",
...
},
{
"id":"7bf9a28647384196b6db238603cf245e",
"name":"My Second Page",
"slug":"my-second-page",
...
}
],
"total_items":2
}

Get a specific page

If you want to show a perticular page, you simply have to fetch the page endpoint url with the page matching id. You can fetch it with an HTTP GET request. Let's fetch the page with the id 1

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