NAV

Get Started

In this guide, you are going to learn how to interact with sections as a frontend developer. If you are a vueJS dev you can use our ready made vue-sections library.

If you wish to create your own client implementation, keep reading.

Step 1: Register here to get your project_id.

Step 2: With your project_id you can start requesting sections yet to create pages and add content to them you need an access token. Read below to understand how to get an access token for your project.

Note: All requests that are secured by a Section token is subject to CORS verification

API's base URL is https://sections.geeks.solutions

Models

Dashboard

Dashboard information returned that conveys package limitations and current consumption

{
  "package_name": "free",
  "max_pages": 2,
  "max_media_files": 10,
  "max_file_size": 500000,
  "current_pages": 0,
  "current_medias": 0,
  "api_until_reset": 46674951,
  "api_limit_use": 500,
  "api_current_use": 0
}
Property Description Type Required
api_current_use current rate limtied requests ina specific day boolean true
api_limit_use Maximum allowed rate-limited requests in a specific day - Package limitation string true
api_until_reset Timestamp in milliseconds until the API rate-limited consumption is reset integer true
current_medias Count of total files currently present linked to pages of this project. integer true
current_pages Count of number of pages currently created in the project. integer true
max_file_size Maximum allowed file size (in bytes) that can be used in pages of this project - Package limitation. integer true
max_media_files Maximum allowed files that can be present linked to pages of this project - Package limitation. integer false
max_pages Maximmum number of pages that can be created in the project. - Package limitation integer true
package_name The package's name the project is subscribed to. string true

Error

Errors returned by sections

{
  "error": "Section type  already exists"
}
Property Description Type Required
error Description of the error string false

Invitation

This is the response of the invitation API call.

{
  "invited": [
    "email1@gmail.com",
    "email2@gmail.com"
  ],
  "failed_to_send": [
    "email3@gmail.com"
  ],
  "demotion": [
    "superiorrole@gmail.com"
  ]
}
Property Description Type Required
demotion List of emails that are already in the project and have a superior role to the invitation one. array(any) false
failed_to_send List of failed invitation emails array(any) false
invited List of successfully invited emails array(any) false

Media

A media is an entity that presents a file in Sections

{
  "type": "image",
  "namespace": "608c0177d66ef2000836a374",
  "id": "613874bc0a998613c74b338c",
  "files": [
    {
      "url": "https://s3.amazonaws.com/eweevtestbucketprivate/sections%2Fa5ac5bc7e6d643f89a4f15c4d8f29aec89ba3988ab904d6aae5934719d4df19a.png",
      "type": "image/png",
      "thumbnail_url": "https://s3.amazonaws.com/eweevtestbucketprivate/sections%2Fa5ac5bc7e6d643f89a4f15c4d8f29aec89ba3988ab904d6aae5934719d4df19a_thumbnail.png",
      "size": 25442,
      "platform_id": "611610df0a998615afb99c29",
      "filename": "sections/a5ac5bc7e6d643f89a4f15c4d8f29aec89ba3988ab904d6aae5934719d4df19a.png",
      "file_id": "ac411a0825cd280cc219844bf3b64271-12de37"
    }
  ],
  "contents_used": [
    "60cb6953d66ef20008ae2177"
  ],
  "author": "60cb6953d66ef20008ae2177"
}
Property Description Type Required
contents_used List of pages related to this media array(any) false
files List of files array(any) true
id Unique identifier string true
namespace The project id using this media string false
type Media type (image, video..) string false

Message

A confirmation message back to the user upon successfull action

{
  "message": "Section type  deleted succesfully"
}
Property Description Type Required
message a message string false

Options

Options returned by third party applications for a configurable section type

[
  {
    "option_values": [
      1,
      2,
      3
    ],
    "field": "article_ids"
  }
]
Property Description Type Required
error Array of options with their possible values array(any) false

Package

A package is the subscription of your project in section. It represents what the project is offered in term of resources.

{
  "name": "standard",
  "limits": [
    {
      "value": 5,
      "name": "number_of_pages",
      "label": "Max number of pages"
    },
    {
      "value": 3,
      "name": "variation_per_page",
      "label": "Max number of variation per page"
    },
    {
      "value": 20,
      "name": "static_sections",
      "label": "Max number of static section types that can be declared"
    },
    {
      "value": 10,
      "name": "sections_total",
      "label": "Max number of sections per page"
    },
    {
      "value": 100,
      "name": "hosted_files",
      "label": "Max number of files hosted"
    },
    {
      "value": 1000000,
      "name": "size_per_file",
      "label": "Maximum Size Per File (in bytes)"
    },
    {
      "value": -1,
      "name": "api_limit_sec",
      "label": "API rate limit per sec"
    },
    {
      "value": -1,
      "name": "api_limit_minute",
      "label": "API rate limit per minute"
    },
    {
      "value": 500,
      "name": "api_limit_hour",
      "label": "API rate limit per hour"
    },
    {
      "value": 1000,
      "name": "api_limit_day",
      "label": "API rate limit per day"
    }
  ],
  "label": "Standard"
}
Property Description Type Required
currency The currency of the price string false
id Unique identifier string true
label The title of the package string false
limits A list of limits, it shows up to how much resources can your project consume array(any) false
name Unique name of the package string false
price The price of the package integer false
type The type of the package could be private or a public one. string false

Page

A page is layout of different sections grouped together.

{
  "variations": [
    "variation-1",
    "variation-2"
  ],
  "settings": [
    {
      "weight": 1,
      "type": "dynamic",
      "region": "bottom-left",
      "name": "blogs:categories_articles",
      "id": "123456789123456789123456"
    }
  ],
  "project_id": "5fe309f42a4e7d91aad8964f",
  "page": "home_page",
  "layout": "layout1"
}
Property Description Type Required
id Unique identifier string true
layout The layout title string false
page Name of the page string true
render_data Data requested by the front end developer that he will use to render the content needed. string false
settings List of sections that are included in the page array(any) false
variations A variations for the page string false

Pending_Invitation

This is the response of the get pending_invitation API call.

{
  "users": [
    {
      "role": "webmaster",
      "invited_at": 1652524584,
      "email": "email@gmail.com"
    }
  ],
  "total": 1
}
Property Description Type Required
total Total of pending invitations integer false
users List of pending invitations array(any) false

Project

A Project that a user owns in sections it contains the project credentials and configurations

{
  "type": "private",
  "project_url": [
    "https://your.project.url.com"
  ],
  "private_key": "xxxxxx",
  "package": "free",
  "login_redirect_url": "https://your.project.url.com/redirect_login/admin",
  "id": "601bf1221907a50007ba3f81",
  "files_counter": 0,
  "configured_fields": {
    "blogs ": {
      "project_id": 1,
      "private_key": "xxxxxx"
    }
  },
  "active": true
}
Property Description Type Required
active The status of the project boolean false
configured_fields A list of object (maps) that indicates the configured fields of the third party apps for this project array(any) false
id Unique identifier string true
login_redirect_url The URL Sections redirects connected user to with the auth code to issue a valid access token. string false
package The current subscription of the project string false
project_url The list of base URLs of the project, used to pass CORS. You are allowed to use localhost in the list, as long as you specify the port.Local network IP Addreses are also allowed, only on HTTP and by specifying the port as well. array(any) false
reason The reason of inactivity in case the project is inactive string false
type The type of the project can be public or private string false

Section_Type

A Section Type in Sections

{
  "type": "static",
  "name": "private_static",
  "multiple": false,
  "id": "60195bbd2a4e7df7496d9740",
  "fields": "null",
  "dynamic_options": false,
  "application": "sections",
  "access": "private"
}
Property Description Type Required
access The access to the section type string false
application application that declared the section type string false
authorization_fields Used for third party integration to authorize the use who is asking for the section type map false
fields Used for configurable Section Types fields that can be chosen to render map false
id Unique identifier string true
name Section type's name string false
options Used for configurable Section Types options map false
region The region of the layout that section type will be rendered into default to main. string false
requirements Shows the required fields for a public scoped section type. array(any) false
status Shows the status for a public scoped section type. string false
type The type of the sections i.e. static, local, configurable or dynamic string false
weight The weight of the section type on the layout which means the order integer false

Token

Certain API calls are secured with an access token, read below about authentication to know how to get an access token for your application

{
  "token": "A really long string"
}
Property Description Type Required
token An authentication token string false

User

This is Section's user model. It contains all the information that sections needs to know about you.

{
  "token": "A really long string"
}
Property Description Type Required
email Users email string false
roles DEPRECATED. A list, contains the roles' IDS. array(any) false
roles_object A lsit of objects. Each object contains the role title and id. These are the roles that are assigned tot he user. array(any) false
saas_project_id The section project to which the user is linked to. string false

1. Authentication

In order to issue secured api calls to sections you need an access token, to simplify the generation of such token we implemented a simple flow.

When you register or login successfully you will get redirected to the back office page of your project where you see your project information. There is a field named Login Redirect Url you should populate it with the URL of a page on your project where you will run the Access Token retrieval code. Next to the field, there is a button called Connect to your app with your sections credentials. When clicking this button you will get redirected to your website with an auth_code in the query string. This auth code is required to retrieve your access token from sections in the Get Access Token request.

Once you retrieve your token you have to include it in :ratethe header of the secured requests.

Get access token

Valid auth code/

GET /api/v1/project/62b48284c05af80584ab7583/token/78F93E20056050B6795254BD71304D15
origin: https://02458132-7c06-4fcb-be88-60fe8bcc9956.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI4NGMwNWFmODA1ODRhYjc1ODNqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACBlOWVhNWU1M2NiMTg0MjMyOWE3NjM2NDJlNDNjODBkN20AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAHtcdkYEBYgABUYA.XzkFk49WsY2oCwNlUbRWvnKUnBmKRNoqkXK6HrQz_eI

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIjbRYFwlfFdIABAxC
access-control-allow-origin: https://02458132-7c06-4fcb-be88-60fe8bcc9956.com
{
  "token": "SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI4NGMwNWFmODA1ODRhYjc1ODNqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACBlOWVhNWU1M2NiMTg0MjMyOWE3NjM2NDJlNDNjODBkN20AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAHtcdkYEBYgABUYA.XzkFk49WsY2oCwNlUbRWvnKUnBmKRNoqkXK6HrQz_eI"
}

Use a supplied auth_code to retrieve an access token. The auth_code expires in a few seconds, if you wish to test that using an API client (i.e Postman) make sure to act quickly.

Request

GET api/v1/project/{project_id}/token/{auth_code}

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
auth_code An authentication code that will be returned on redirection when you login/register successfully query_string string true

Responses

Status Description Schema
200 section type resource Token
410 Error Resource Error

2. Working With Pages

A page is where you organize your sections in one or more layouts. In this part you will learn how to create/update/render and delete a page. Please refer to the page models to see all fields a page can contain.

Renders a page

Get an existing page

POST /api/v1/project/62b48253c05af80584f60790/page/page_df38d291-5485-402a-b0b6-549821309fd9
origin: https://051b179b-3cf3-404d-90a6-e72e758901cd.com
user-agent: user-agent-f6d6f95a-3152-4eb8-8484-7944c44450cb
project-id-63831f2d-fb25-4abe-8ea8-a7fa47bd1b0d: 1
content-type: multipart/mixed; boundary=plug_conn_test

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIgnlKNtjv8W0ABAaB
access-control-allow-origin: https://051b179b-3cf3-404d-90a6-e72e758901cd.com
{
  "variations": null,
  "sections": [
    {
      "weight": 1,
      "type": "static",
      "settings": {},
      "render_data": "",
      "region": null,
      "name": "section_name_3d4ab386-76f0-4a25-a063-1a68b04d9f69",
      "linked_to": "",
      "id": "62b48255c05af8058420f713",
      "error": null
    }
  ],
  "page": "page_df38d291-5485-402a-b0b6-549821309fd9",
  "layout": "layout1",
  "invalid_sections": [],
  "id": "62b48255da9ce09a0dac1cf9"
}

Renders a page with all the available sections declared inside.

Request

POST api/v1/project/{project_id}/page/{page_name}

Parameters

Parameter Description In Type Required Default Example
query_string Query Strings body map false {id: 1}
project_id Your project id in Sections query_string string true
page_name The page name query_string string true

Responses

Status Description Schema
200 Project resource Page
404 Error Resource Error
429 Error Resource for rate limiting Message

Creates/updates a page

Create a page with valid section using medias ids

PUT /api/v1/project/62b48231c05af8058439079f/page/page_e52efc08-8765-4fa9-9b18-96fd6d70afeb
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIzMWMwNWFmODA1ODQzOTA3OWZqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA2NGU4NzRlYjlkNDA0OGYxYWYyNmU2ZmRkYzNmNDQ0YW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAuJEckYEBYgABUYA.d_spFPw7w7dgGym6MnIIwWAqg7tao3BZ5FuKhYeiqSs
origin: https://4c0b955c-767a-466b-a6de-bfe979cbc273.com
content-type: multipart/mixed; boundary=plug_conn_test
{
  "variations": [
    "1"
  ],
  "sections": [
    {
      "weight": 1,
      "region": "main",
      "options": [
        {
          "image": {
            "media_id": "62b48233c05af80584811855"
          }
        }
      ],
      "name": "section_name_6c2757d4-52b5-4961-a2b2-687f988223d5"
    }
  ],
  "layout": "layout1"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIequb1YZSteoABACi
access-control-allow-origin: https://4c0b955c-767a-466b-a6de-bfe979cbc273.com
{
  "variations": [
    "1"
  ],
  "sections": [
    {
      "weight": 1,
      "type": "static",
      "settings": [
        {
          "image": {
            "url": "https://www.fake-url.com/4eb0e96abba54007972bffb6d6f1163d",
            "media_id": "62b48233c05af80584811855"
          }
        }
      ],
      "render_data": "",
      "region": null,
      "name": "section_name_6c2757d4-52b5-4961-a2b2-687f988223d5",
      "linked_to": "",
      "id": "62b48234c05af80584eea600",
      "error": null
    }
  ],
  "page": "page_e52efc08-8765-4fa9-9b18-96fd6d70afeb",
  "layout": "layout1",
  "invalid_sections": [],
  "id": "62b48234da9ce09a0dac1b44"
}

Upsert a page in your project with all the sections declared and their configuration so when rendering the page the user gets the same result. If you wish to create an empty page, simply supply an empty sections list in the payload. For each section you can provide options. In the options you can add files for you to use. In order to add a file for a static section type. You need to add the fields that declare files in that section type. For ex: { "fields": [ { "type": "image", "name": "profile_image" }, { "type": "image", "name": "cover_image" } ] }

Now in the options you can provide the image like that: "options": [{"profile_image": "A BASE 64 file string"}]

The base64 will be transformed into a media file.

Or you can provide an existing media id to link to a section on a page.

"options": [{"profile_image": {"media_id": "media_id"}}]

For More details on Medias, please head to the Medias section below.

Request

PUT api/v1/project/{project_id}/page/{page_name}

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
page_name The page name query_string string true
token Sections Token header string true
variations In case you need no Variations of the page send an empty list or null body array true {'variations': ['page1', 'page2']}
sections List of sections that are going to be rendered in the page body array true {'sections': []}
layout Layout title of the page body string false {'sections': []}

Responses

Status Description Schema
200 Project resource Page
401 Error Resource Error
402 Error Resource Error

Deletes a page

delete a page

DELETE /api/v1/project/62b48235c05af80584a6d59f/page/62b48235da9ce09a0dac1b61
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIzNWMwNWFmODA1ODRhNmQ1OWZqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA1NmMwNGYzYzEwMzA0NjhkOThiYjViMjVlNzdiOTAwMW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAU58ckYEBYgABUYA.gjY_FEpJLFBrWsXt7a65qnHWsJtnxy5IWQjEjAfquH4
origin: https://735fa0ec-7e6e-4d20-905f-359da4decb99.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIeyDg_hhY-5QABAEB
access-control-allow-origin: https://735fa0ec-7e6e-4d20-905f-359da4decb99.com
{
  "message": "Successfully deleted 62b48235da9ce09a0dac1b61"
}

Deletes the page for your project. This call will erase all the data you have stored for the sections added in this particular page.

Request

DELETE api/v1/project/{project_id}/page/{page_id}

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
project_id Your project id in Sections query_string string true
page_id The page id in Sections query_string string true

Responses

Status Description Schema
200 Project resource Message
401 Error Resource Error
404 Error Resource Error

3. Working With Section Types

### Sections supports four section types:

  1. Local: This section type is totally declared and rendered on your frontend project. We have added support for such contents so you can blend it with the rest of section and define where in the page this content should display in between other sections. To add a local section to your page you just need to add a section object to your payload with type local and a name of your choice so you can then match it to the right content to render when you are to render the page to your visitor.

  2. Static: Static sections are supported out of the box. A static section is a very simple piece of content that provides a basic object storage for the frontend developer. This section can be used to store simple html, images in base64 format (do not abuse it :-) or even JS/CSS code if you need to. This section is called static because from a server's perspective the content returned by this section is directly loaded from the Database with no processing, yet you can, as a frontend developer provide very dynamic end results by relying on external APIs at the javascript level (i.e facebook plugins, api request on frontend level etc...). You are just limited by your imagination here.

  3. Dynamic: A dynamic section type is a bit more interesting as the content of such sections will be loaded dynamically server side. A dynamic section type will be declared by a backend third party and it will be called each time this section is requested for rendering.

  4. Configurable: A configurable section is similar to a dynamic one as both have dynamic contents. The difference here is that a configurable section has options that the page editor can choose from. These options are stored in sections and provided to the third party server for rendering so you don't have to worry about that.

Accesses

Accesses to section types varies between:

Returns the list of section types the project owns

GET Section Types

GET /api/v1/project/62b48235c05af80584a6d5a4/section-types
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIzNWMwNWFmODA1ODRhNmQ1YTRqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACAzZjU4OTE2NjdkYjE0NWNlYjc0YWYwMzI0Y2QwMTRhYm0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAraIckYEBYgABUYA.PMe-053J2yb-Pc-c1vG2EiOHQlJ1Sy_eavgCt0voy80
origin: https://cc6e8d28-da80-4958-852f-9e5ba197d121.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIezFO0uzNcUQABAFB
access-control-allow-origin: https://cc6e8d28-da80-4958-852f-9e5ba197d121.com
{
  "data": [
    {
      "type": "dynamic",
      "requirements": [
        "private_key",
        "project_id"
      ],
      "query_string_keys": null,
      "name": "62b48234c05af80584eea604:top_articles",
      "multiple": false,
      "id": "62b48235da9ce09a0dac1b59",
      "fields": [],
      "dynamic_options": false,
      "application_id": "62b48234c05af80584eea604",
      "application": "62b48234c05af80584eea604",
      "app_status": "disbaled",
      "access": "public_scoped"
    },
    {
      "type": "configurable",
      "requirements": [
        "private_key",
        "project_id"
      ],
      "query_string_keys": null,
      "name": "62b48234c05af80584eea604:selective_articles",
      "multiple": true,
      "id": "62b48235da9ce09a0dac1b5b",
      "fields": [
        {
          "type": "integer",
          "name": "articles_ids",
          "key": "articles_ids"
        }
      ],
      "dynamic_options": true,
      "application_id": "62b48234c05af80584eea604",
      "application": "62b48234c05af80584eea604",
      "app_status": "disbaled",
      "access": "public_scoped"
    }
  ]
}

Load all the section types the project has access to. This can be custom static section types, private section types or public ones exposed by other backend third party developers. For section types with public scoped access you can know their status and required fields in this call also the application id to which they belong. This is helpful for updating your security fields for the considered application.

Request

GET api/v1/project/{project_id}/section-types

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
project_id Your project id in Sections query_string string true

Responses

Status Description Schema
200 List of section types resource Section_Type
401 Error Resource Error

Creates a static section type

Create Static ST

POST /api/v1/project/62b4822fc05af80584cbe1cd/section-types/section_name_60d2dea0-c31f-4720-bd80-5e45679fdb2d
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIyZmMwNWFmODA1ODRjYmUxY2RqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA0ODUzYjNlYTBhYWQ0MGQxOWFhY2I1ODFlMmY0MGRjY20AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAnoockYEBYgABUYA.kIbmPvI_jNDRg1lHxIOCHJjVVnIW8u1jWtq7wPf6vug
origin: https://82835aba-c745-4492-b7f4-45ed92f9dcd6.com
content-type: multipart/mixed; boundary=plug_conn_test
{
  "fields": [
    {
      "type": "image",
      "name": "profile"
    },
    {
      "type": "image",
      "name": "profile1"
    }
  ]
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIecI1LZrwtoMAA_9i
access-control-allow-origin: https://82835aba-c745-4492-b7f4-45ed92f9dcd6.com
{
  "type": "static",
  "name": "section_name_60d2dea0-c31f-4720-bd80-5e45679fdb2d",
  "multiple": false,
  "id": "62b48230c05af80584c9526a",
  "fields": [
    {
      "type": "image",
      "name": "profile"
    },
    {
      "type": "image",
      "name": "profile1"
    }
  ],
  "dynamic_options": false,
  "application_id": null,
  "application": "sections",
  "access": "private"
}

Declares a PRIVATE static section type for your project. Private sections are exclusive to only one project so these will only be visible by you.

Request

POST api/v1/project/{project_id}/section-types/{section_name}

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
project_id Your project id in Sections query_string string true
section_name Section name query_string string true

Responses

Status Description Schema
200 section type resource Section_Type
400 Error Resource Error
401 Error Resource Error
402 Error when you reach your package limitation Error

Update the authroization fields for the considered app on your project

Upsert authorization fields for an application

PUT /api/v1/project/62b48231c05af8058439079c/authorization_fields/123456
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIzMWMwNWFmODA1ODQzOTA3OWNqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACAxZWYyMmVkY2Q1MzA0MjFlOGU4NWVmY2VhOGQ4MGFjZG0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAWJAckYEBYgABUYA.ugwquMwpxSbPJ3yX2ZRChCoujYoISHM1Gtht-iHtZ6Q
origin: https://0cf3da7b-5df2-4685-a1d4-f8f3ccc20883.com
content-type: multipart/mixed; boundary=plug_conn_test
{
  "authorization_fields": {
    "project_id": 38,
    "private_key": "private_key_hashed"
  }
}

Response

404
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIehmTt-o768wAA_0h
access-control-allow-origin: https://0cf3da7b-5df2-4685-a1d4-f8f3ccc20883.com
{
  "message": "The app does not exist"
}

It verifies the authorization fields provided. If the fields are valid then the project's configured fields will be updated to include this app's credentials. These credentials will be used to render any public scoped section decalred by the third party app. In case the credentials become at some point invalid their status will be updated and it will need an update from the user. This call will let you retrieve the application id for any public scoped section.

Request

PUT api/v1/project/{project_id}/token/{application_id}

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
project_id Your project id in Sections query_string string true
application_id The application's id in Sections query_string string true
authorization_fields Authorization fields used to authenticate your request to third party services (only for public scoped section types) body map true {authorization_fields: {username: 'You', password: 'are awsome'} }

Responses

Status Description Schema
200 Project resource Project
410 Error Resource Error

Renders the requested section's data

Render an existing ST

POST /api/v1/project/62b4822dc05af80584f8f1a7/section/render
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIyZGMwNWFmODA1ODRmOGYxYTdqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA2ZTJhMTg0MGNiZjU0ZjhlODE1ZTUzYTgzMDg0OTNiMW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAB4IckYEBYgABUYA.8luFAGdFRb9cseP4azVVfB7ygkKjJKokHPho1m7Crbk
origin: https://82311486-8cfc-4fb0-bece-b6b7fe0b4d92.com
content-type: multipart/mixed; boundary=plug_conn_test
{
  "section": {
    "weight": 1,
    "name": "section_name_4043d956-a7c8-4fd9-9942-dd9c5b369fef"
  }
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIeWJNnh5izRYAA_rh
access-control-allow-origin: https://82311486-8cfc-4fb0-bece-b6b7fe0b4d92.com
{
  "weight": 1,
  "type": "static",
  "settings": {},
  "render_data": "",
  "region": null,
  "name": "section_name_4043d956-a7c8-4fd9-9942-dd9c5b369fef",
  "linked_to": "",
  "id": "62b4822ec05af8058461f059",
  "error": null
}

Renders the section's data for a preview. When rendering a public scoped section type and the request returns an unauthorized request error (status code 401). The section's status will be updated to invalid. Then it will need the user's intervention to update his credentials for this section's application using this endpoint so the status gets adjusted again.

Request

POST api/v1/project/{project_id}/section/render

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
project_id Your project id in Sections query_string string true
query_string Query Strings body map false {id: 1}
section A map containing the section name and its order (weight) in the page body map true {section: {name: '6038e54de3ba240007b07913:categories_articles', weight: '1'} }

Responses

Status Description Schema
200 section type resource Section_Type
400 Error Resource Error
401 Error Resource Error

Gets a configurable section type's options

Returning the options of a configurable section type to Sections

GET /api/v1/project/62b48234c05af80584eea603/section/62b48234c05af80584eea604%3Aselective_articles/options
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIzNGMwNWFmODA1ODRlZWE2MDNqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA4MGQ2NmM1ZmNmOGY0YTQ2YWU0YTRhNTUxMWIxMTRmZW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYA3JwckYEBYgABUYA.IcdnQQSsnSWB_k-Onnzx5EM56YIpmAOorj2B6a3l4dM
origin: https://a42eba23-3dc9-4277-b7ab-e87794feeb3b.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIewtbD19wNHEABAKC
access-control-allow-origin: https://a42eba23-3dc9-4277-b7ab-e87794feeb3b.com
[
  {
    "option_values": [
      {
        "title": "Article 1",
        "id": 1
      },
      {
        "title": "Article 2",
        "id": 2
      }
    ],
    "field": "article_ids"
  }
]

Gets a configurable section type's options from the third party application. This is used so the user can choose the options he wants in order to render the configurable section type customized to his needs.

Request

GET api/v1/project/{project_id}/section/{section_name}/options

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
project_id Your project id in Sections query_string string true
section_name Section name query_string string true

Responses

Status Description Schema
200 Options resource Options
400 Error Resource Error
404 Error Resource Error

Deletes a static section type

Delete Static ST

DELETE /api/v1/project/62b48229c05af805844ae2ca/section-types/section_name_ec1f9635-4f04-472c-9509-bc603e9f4b7e
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIyOWMwNWFmODA1ODQ0YWUyY2FqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACBlYzA3ZjdlODgzZjA0MTQwYjU5OTVkMGIxOTUzNzExYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAz3EckYEBYgABUYA.MG-yd9OYvHdp5lxZpS4SoV7y2Iji-iDCp0Bg4UZKX-g
origin: https://a2e7ec9a-13dc-4b28-bc96-204897215861.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIeHlcmA9m8RAAA_cB
access-control-allow-origin: https://a2e7ec9a-13dc-4b28-bc96-204897215861.com
{
  "message": "Static Section was deleted successfully."
}

Deletes a static section type

Request

DELETE api/v1/project/{project_id}/section-types/{section_name}

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
project_id Your project id in Sections query_string string true
section_name Section name query_string string true

Responses

Status Description Schema
200 message resource Message
404 Error Resource Error

4. Packages and API limits

To ensure a faire usage from all users and provide a stable quality of service we have two layers of limitations, the first one is based on the resources your project can use, the bigger the package the more resources you are allowed to use (i.e number of pages, number of static sections types etc...). Once you reach a limit, any tentative to cross this limit will return an error with code 402. The only way for you to overcome this is to free up some resources or to upgrade your package.

Then we also are capping the number of requests you can issue on a project, here again the package you are on will define your cap. The bigger the package the more API requests you will be authorized to submit. If you reach your limit, any further requests will error with code 429. These limits gets reset per time cycle, you can either wait for the cycle to reset your limit or you can upgrade your package to overcome this limit.

Read below to retrieve your project package with the details of the limits applying to it

Gets the current package of the project

GET a package by name and active package/

GET /api/v1/project/62b482e9c05af805846afb75/active_package
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODJlOWMwNWFmODA1ODQ2YWZiNzVqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA0MzkyMzA5YzBjYWU0YzhiODRmMTRmMGNmMzBiOGVjZW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAhWAfkYEBYgABUYA.t3SUHy5WnMMPkPm3x7Gu8jKoxT4tiv0NfdvI-tOT7gI
origin: https://4385fa8e-4337-4153-b988-f6db270d4027.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIpSfm347SvVEABCAC
access-control-allow-origin: https://4385fa8e-4337-4153-b988-f6db270d4027.com
{
  "name": "free",
  "limits": [
    {
      "value": 0,
      "name": "query_string_support",
      "label": "Query string support for dynamic pages"
    },
    {
      "value": 2,
      "name": "number_of_pages",
      "label": "Max number of pages"
    },
    {
      "value": 1,
      "name": "variation_per_page",
      "label": "Max number of variation page"
    },
    {
      "value": 5,
      "name": "static_sections",
      "label": "Max number of static section types that can be declared"
    },
    {
      "value": 5,
      "name": "sections_total",
      "label": "Max number of sections per page"
    },
    {
      "value": 10,
      "name": "hosted_files",
      "label": "Max number of files hosted"
    },
    {
      "value": 500000,
      "name": "size_per_file",
      "label": "Maximum Size Per File (in bytes)"
    },
    {
      "value": 10,
      "name": "api_limit_sec",
      "label": "API rate limit per second"
    },
    {
      "value": 100,
      "name": "api_limit_minute",
      "label": "API rate limit per minute"
    },
    {
      "value": -1,
      "name": "api_limit_hour",
      "label": "API rate limit per hour"
    },
    {
      "value": 500,
      "name": "api_limit_day",
      "label": "API rate limit per day"
    }
  ],
  "label": "Free",
  "id": "62b48226c05af80584048859"
}

This call will return the package name and associated limits for your project

Request

GET /api/v1/project/{project_id}/active_package

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
token Sections Token header string true

Responses

Status Description Schema
200 Package Resource Package

Get available packages

GET all public packages

GET /api/v1/project/62b482ebc05af805841f6cec/packages
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODJlYmMwNWFmODA1ODQxZjZjZWNqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA1NGFjZTE3ZGI5Yzc0MzdkYjg5ZGJkMmZjODEwYjYxYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAfWYfkYEBYgABUYA.RBz5rrBNjAX3AjWtrnxpc-JcpDvNZaOdxWQapQVvheE
origin: https://d4737922-4f73-4e9b-a5df-f0eab2eb40ec.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIpWGkoluekewABBbh
access-control-allow-origin: https://d4737922-4f73-4e9b-a5df-f0eab2eb40ec.com
{
  "data": [
    {
      "name": "free",
      "limits": [
        {
          "value": 0,
          "name": "query_string_support",
          "label": "Query string support for dynamic pages"
        },
        {
          "value": 2,
          "name": "number_of_pages",
          "label": "Max number of pages"
        },
        {
          "value": 1,
          "name": "variation_per_page",
          "label": "Max number of variation page"
        },
        {
          "value": 5,
          "name": "static_sections",
          "label": "Max number of static section types that can be declared"
        },
        {
          "value": 5,
          "name": "sections_total",
          "label": "Max number of sections per page"
        },
        {
          "value": 10,
          "name": "hosted_files",
          "label": "Max number of files hosted"
        },
        {
          "value": 500000,
          "name": "size_per_file",
          "label": "Maximum Size Per File (in bytes)"
        },
        {
          "value": 10,
          "name": "api_limit_sec",
          "label": "API rate limit per second"
        },
        {
          "value": 100,
          "name": "api_limit_minute",
          "label": "API rate limit per minute"
        },
        {
          "value": -1,
          "name": "api_limit_hour",
          "label": "API rate limit per hour"
        },
        {
          "value": 500,
          "name": "api_limit_day",
          "label": "API rate limit per day"
        }
      ],
      "label": "Free",
      "id": "62b48226c05af80584048859"
    },
    {
      "name": "standard",
      "limits": [
        {
          "value": 0,
          "name": "query_string_support",
          "label": "Query string support for dynamic pages"
        },
        {
          "value": 5,
          "name": "number_of_pages",
          "label": "Max number of pages"
        },
        {
          "value": 2,
          "name": "variation_per_page",
          "label": "Max number of variation per page"
        },
        {
          "value": 10,
          "name": "static_sections",
          "label": "Max number of static section types that can be declared"
        },
        {
          "value": 10,
          "name": "sections_total",
          "label": "Max number of sections per page"
        },
        {
          "value": 100,
          "name": "hosted_files",
          "label": "Max number of files hosted"
        },
        {
          "value": 1000000,
          "name": "size_per_file",
          "label": "Maximum Size Per File (in bytes)"
        },
        {
          "value": -1,
          "name": "api_limit_sec",
          "label": "API rate limit per sec"
        },
        {
          "value": -1,
          "name": "api_limit_minute",
          "label": "API rate limit per minute"
        },
        {
          "value": 500,
          "name": "api_limit_hour",
          "label": "API rate limit per hour"
        },
        {
          "value": 1000,
          "name": "api_limit_day",
          "label": "API rate limit per day"
        }
      ],
      "label": "Standard",
      "id": "62b48226c05af8058404885a"
    },
    {
      "name": "corporate",
      "limits": [
        {
          "value": 10,
          "name": "number_of_pages",
          "label": "Max number of pages"
        },
        {
          "value": -1,
          "name": "query_string_support",
          "label": "Query string support for dynamic pages"
        },
        {
          "value": 5,
          "name": "variation_per_page",
          "label": "Max number of variation page"
        },
        {
          "value": 20,
          "name": "static_sections",
          "label": "Max number of static section types that can be declared"
        },
        {
          "value": 15,
          "name": "sections_total",
          "label": "Max number of sections per page"
        },
        {
          "value": 300,
          "name": "hosted_files",
          "label": "Max number of files hosted"
        },
        {
          "value": 2000000,
          "name": "size_per_file",
          "label": "Maximum Size Per File (in bytes)"
        },
        {
          "value": -1,
          "name": "api_limit_sec",
          "label": "API rate limit per sec"
        },
        {
          "value": -1,
          "name": "api_limit_minute",
          "label": "API rate limit per minute"
        },
        {
          "value": 3000,
          "name": "api_limit_hour",
          "label": "API rate limit per hour"
        },
        {
          "value": 20000,
          "name": "api_limit_day",
          "label": "API rate limit per day"
        }
      ],
      "label": "Corporate",
      "id": "62b48226c05af8058404885b"
    },
    {
      "name": "premium",
      "limits": [
        {
          "value": -1,
          "name": "query_string_support",
          "label": "label"
        },
        {
          "value": 20,
          "name": "number_of_pages",
          "label": "label"
        },
        {
          "value": 1,
          "name": "variation_per_page",
          "label": "label"
        },
        {
          "value": 10,
          "name": "static_sections",
          "label": "label"
        },
        {
          "value": 5,
          "name": "sections_total",
          "label": "label"
        },
        {
          "value": 7,
          "name": "hosted_files",
          "label": "label"
        },
        {
          "value": 500000,
          "name": "size_per_file",
          "label": "label"
        },
        {
          "value": 10,
          "name": "api_limit_sec",
          "label": "label"
        },
        {
          "value": -1,
          "name": "api_limit_hour",
          "label": "label"
        },
        {
          "value": 100,
          "name": "api_limit_minute",
          "label": "label"
        },
        {
          "value": 500,
          "name": "api_limit_day",
          "label": "label"
        }
      ],
      "label": "premium",
      "id": "62b482dfc05af8058448e5bb"
    },
    {
      "name": "new_name",
      "limits": [
        {
          "value": -1,
          "name": "query_string_support",
          "label": "label"
        },
        {
          "value": 2,
          "name": "number_of_pages",
          "label": "label"
        },
        {
          "value": 1,
          "name": "variation_per_page",
          "label": "label"
        },
        {
          "value": 10,
          "name": "static_sections",
          "label": "label"
        },
        {
          "value": 5,
          "name": "sections_total",
          "label": "label"
        },
        {
          "value": 10,
          "name": "hosted_files",
          "label": "label"
        },
        {
          "value": 500000,
          "name": "size_per_file",
          "label": "label"
        },
        {
          "value": 10,
          "name": "api_limit_sec",
          "label": "label"
        },
        {
          "value": 100,
          "name": "api_limit_minute",
          "label": "label"
        },
        {
          "value": 100,
          "name": "api_limit_hour",
          "label": "label"
        },
        {
          "value": 500,
          "name": "api_limit_day",
          "label": "label"
        }
      ],
      "label": "Free",
      "id": "62b482e0c05af80584ecef9b"
    },
    {
      "name": "something",
      "limits": [
        {
          "value": -1,
          "name": "query_string_support",
          "label": "label"
        },
        {
          "value": 2,
          "name": "number_of_pages",
          "label": "label"
        },
        {
          "value": 1,
          "name": "variation_per_page",
          "label": "label"
        },
        {
          "value": 10,
          "name": "static_sections",
          "label": "label"
        },
        {
          "value": 5,
          "name": "sections_total",
          "label": "label"
        },
        {
          "value": 10,
          "name": "hosted_files",
          "label": "label"
        },
        {
          "value": 500000,
          "name": "size_per_file",
          "label": "label"
        },
        {
          "value": 10,
          "name": "api_limit_sec",
          "label": "label"
        },
        {
          "value": 100,
          "name": "api_limit_minute",
          "label": "label"
        },
        {
          "value": 100,
          "name": "api_limit_hour",
          "label": "label"
        },
        {
          "value": 500,
          "name": "api_limit_day",
          "label": "label"
        }
      ],
      "label": "Free",
      "id": "62b482e7c05af8058490033c"
    }
  ]
}

This call will list all the public packages with their attached limits that your project can subscribe to. If you have specific needs requiring the customization of certains limits, contact us to build with you a custom private package.

Request

GET /api/v1/project/{project_id}/packages

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
token Sections Token header string true

Responses

Status Description Schema
200 List of package resource Package

5. User Management

This part will guide on how to manage your account on Sections.

Register through the API

Register user and project

POST /api/v1/register
origin: http://clientapp.com:3001
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI3OWMwNWFmODA1ODQ1NjJlMjNqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA0ZjVkN2Q0MGI0NmE0MWFlYjEyYTM3M2M2YWQ1NTM3NW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYA8asdkYEBYgABUYA.A7Lg6iI70RtEmCo5_1BaUOYdwRO2NTrIj0LCd3SCbT8
content-type: multipart/mixed; boundary=plug_conn_test
{
  "user": {
    "terms_conditions": true,
    "password": "password",
    "full_name": "Fullname",
    "email": "success@gmail.com"
  },
  "project": {
    "title": "Your Project Title",
    "project_url": [
      "https://your.url.com"
    ],
    "login_redirect_url": "https://your.url.com"
  }
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIiw30-_fQLvQABArC
access-control-allow-origin: http://clientapp.com:3001
{
  "data": {
    "user": {
      "user_id": "123userid123",
      "saas_project_id": [
        {
          "title": "Your Project Title",
          "saas_project_id": "62b4827ac05af80584a44706",
          "role": "admin"
        }
      ],
      "last_login": 1655997050,
      "full_name": "Someone",
      "email": "someone51eee547156345a199e118992327551a@eweev.com"
    },
    "token": {
      "token": "this is a token"
    },
    "project": {
      "updated_at": 1655997050,
      "type": "private",
      "title": "Your Project Title",
      "reason": null,
      "project_url": [
        "https://your.url.com"
      ],
      "private_key": "V70kaKG16Ain4jRe1aBhmzfBY6CAIf0Q",
      "package": "free",
      "login_redirect_url": "https://your.url.com",
      "last_req_date": null,
      "inserted_at": "2022-06-23",
      "id": "62b4827ac05af80584a44706",
      "files_counter": 0,
      "configured_fields": {},
      "active": true,
      "__meta__": {
        "state": "built",
        "source": "project",
        "schema": "Elixir.Sections.Section.Project",
        "prefix": null,
        "context": null
      }
    }
  }
}

API Route to be able to register a new user, and create this user's new project.

We now support the ability to include multiple project URLs used to pass CORS, by passing a list of valid URLS as the value of project_key

Request

POST api/v1/register

Parameters

Parameter Description In Type Required Default Example
project Project Model. body map true {'active' => true,'configured_fields' => {'blogs' => {'private_key' => 'xxxxxx','project_id' => 1}},'files_counter' => 0,'id' => '601bf1221907a50007ba3f81','login_redirect_url' => 'https://your.project.url.com/redirect_login/admin','package' => 'free','private_key' => 'xxxxxx','project_url' => ['https://your.project.url.com'],'reason' => nil,'type' => 'private'}
user User Model. body map true {email: 'your_new_email@gmail.com', password: 'new_pass', current_pass: 'current_pass'} }

Responses

Status Description Schema
200 User resource User
410 Error Resource Error

Cancel an invitation

Accept invitation to project failure - invitation cancelled

DELETE /api/v1/project/62b4826ec05af8058408fb3b/cancel_invitation
origin: https://9248acce-8361-4b39-be03-a5c06f217d5c.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAFYWRtaW5tAAAAD3NhYXNfcHJvamVjdF9pZG0AAAAYNjJiNDgyNmVjMDVhZjgwNTg0MDhmYjNiam0AAAAGc3RhdHVzbQAAAAh2ZXJpZmllZG0AAAAHdXNlcl9pZG0AAAAgYWFiNDgyZjhiN2YwNDhjYTgwOWVlZTE5MTg3ODlhNWFtAAAABnN0YXR1c20AAAAHc3VjY2Vzc24GAMSEHZGBAWIAAVGA.E2RNxz3W5OTQrIEapWT9t3lO1HK9WRx8vx_BCxhaV44
content-type: multipart/mixed; boundary=plug_conn_test
{
  "invitation_user_email": "email1@email.com"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIiOQ1ecxNDYoABAkC
access-control-allow-origin: https://9248acce-8361-4b39-be03-a5c06f217d5c.com
{
  "message": "Invitation cancelled successfuly"
}

Used to cancel invitations sent to specific emails.

Request

DELETE api/v1/project/:project_id/cancel_invitation

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
invitation_email Email to cancel invitation to the project body string true 'email1@gmail.com','email2@gmail.com'

Responses

Status Description Schema
200 Message Resource Message
401 Error Resource Error

Get your user information.

get user based on token

GET /api/v1/project/62b48264c05af80584f6c68f/user
origin: https://3724a89b-54e1-45a0-81b2-a80c0059a0a4.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAJd2VibWFzdGVybQAAAA9zYWFzX3Byb2plY3RfaWRtAAAAGDYyYjQ4MjY0YzA1YWY4MDU4NGY2YzY4ZmptAAAABnN0YXR1c20AAAAIdmVyaWZpZWRtAAAAB3VzZXJfaWRtAAAAIDk5YmY5M2JmOWI2MDQxZGM4MzA0MGFmODhhOTE0NTIybQAAAAZzdGF0dXNtAAAAB3N1Y2Nlc3NuBgBaWR2RgQFiAAFRgA.hIGcKPKrVpInBNeEr5qZtnTEwaeUFNsMIfXaICYWh3k
{
  "aspect": "body_params"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIhhTF7Kh5fE0ABAmh
access-control-allow-origin: https://3724a89b-54e1-45a0-81b2-a80c0059a0a4.com
{
  "token": null,
  "status": null,
  "roles": null,
  "projects": [
    {
      "saas_project_id": "62b48264c05af80584f6c68f",
      "role": "admin"
    }
  ],
  "inserted_at": null,
  "id": "1",
  "full_name": "Full Name",
  "email": "email@eweev.com"
}

Used to get your own user information based on the token.

Request

GET api/v1/project/:project_id/user

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
origin Request Origin header string true https://your.project.url.com
token Sections Token header string true

Responses

Status Description Schema
200 User resource User
401 Error Resource Error

Login through the API

login

POST /login
origin: http://clientapp.com:3001
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI3ZmMwNWFmODA1ODQ5Mzc5ZDVqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACBiMjYzMjI2YWFlN2Y0MmRjOGRhYmI5ZjNjZTFhYTAxYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYADMEdkYEBYgABUYA.YpCCZuZcx-zFYXqPKM9t1W5hg0vwyOowCuvE6cv_6h4
content-type: multipart/mixed; boundary=plug_conn_test
{
  "password": "password",
  "email": "success@gmail.com"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIjE-5JglMX_4ABAsi
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
x-download-options: noopen
x-permitted-cross-domain-policies: none
cross-origin-window-policy: deny
{
  "token": {
    "token": "this is a token"
  },
  "status": null,
  "roles": null,
  "projects": [
    {
      "title": null,
      "saas_project_id": "62b4827fc05af805849379d5",
      "role": "webmaster"
    }
  ],
  "inserted_at": null,
  "id": "123userid123",
  "full_name": "Someone",
  "email": "someonea6496a6ef6274b018787e2f7751b0d40@eweev.com"
}

API Route to be able to login and retrieve a user token, used for authorization.

The project_id query parameter, alongside the project URL as the origin header, are used to be able to pass CORS. You can also use the encoded version of the project private key to bypass CORS, and act as the project administrator.

Request

POST api/v1/login?project_id={PROJECT_ID}

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
origin Request Origin header string true https://your.project.url.com

Responses

Status Description Schema
200 User resource User
410 Error Resource Error

Updates User

Update User

PUT /api/v1/project/62b48293c05af8058483616a/user
origin: https://83c97421-3951-4714-831d-b554ee6a80f4.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI5M2MwNWFmODA1ODQ4MzYxNmFqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA0MmZiNGIyNzdjOTg0NGUxYWJiZDk4NTdhYzE5Y2E3MG0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYA8BEekYEBYgABUYA.ikkcnAmNhhyjqMKNmBrMSw9XdN3-OqzA-dYHKfzZXxI
content-type: multipart/mixed; boundary=plug_conn_test
{
  "password": "new_password",
  "full_name": "Your updated name",
  "email": "new_email@eweev.com",
  "current_password": "your_current_pass",
  "confirm_password": "new_password"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIkRU-lB0lDY4ABBBC
access-control-allow-origin: https://83c97421-3951-4714-831d-b554ee6a80f4.com
{
  "token": null,
  "status": "pending",
  "roles": null,
  "projects": null,
  "inserted_at": null,
  "id": "42fb4b277c9844e1abbd9857ac19ca70",
  "full_name": "Your updated name",
  "email": "new_email@eweev.com"
}

This call updates the user. Be careful when updating your email or password you need to supply you current password to authenticate your call under the field current_password.

Request

PUT api/v1/project/{project_id}/user

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
token Sections Token header string true
user User Model. body map true {email: 'your_new_email@gmail.com', password: 'new_pass', current_pass: 'current_pass'} }

Responses

Status Description Schema
200 section type resource User
400 section type resource Error
410 Error Resource Error

Add a User

Add a user to a project

PUT /api/v1/project/62b4828ac05af80584dc908b/add_user
origin: https://ae44e923-a818-4c0a-96b5-98f6bfea9d61.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI4YWMwNWFmODA1ODRkYzkwOGJqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA4NWNmODNkZWI5MDU0NjIzOTg3MWVjOWQ1OGMyZjZjNm0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYA8-wdkYEBYgABUYA.yUZWDQK2eEDLXrpdRWCLb7-7YOBw1vma4roEMO0iqnQ
content-type: multipart/mixed; boundary=plug_conn_test
{
  "saas_project_id": "62b4828ac05af80584dc908b",
  "role": "User",
  "email": "USER_EMAIL@gmail.com"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIjuDURSbnGAUABA1C
access-control-allow-origin: https://ae44e923-a818-4c0a-96b5-98f6bfea9d61.com
{
  "token": null,
  "status": null,
  "roles": null,
  "projects": [
    {
      "saas_project_id": "62b4828ac05af80584dc908b",
      "role": "User",
      "accepted_on": 1655997067
    }
  ],
  "inserted_at": null,
  "id": "72b38732-e9c9-4aec-bc2a-709ca7991935",
  "full_name": null,
  "email": null
}

This call adds the user, of the given email, to a project you are an admin on.

Request

PUT api/v1/project/{project_id}/add_user

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
token Sections Token header string true
user User Model. body map true [123,10,32,32,32,32,32,32,34,115,97,97,115,95,112,114,111,106,101,99,116,95,105,100,34,58,32,34,54,48,100,97,101,49,97,49,48,97,57,57,56,54,50,99,50,97,55,48,97,98,49,49,34,44,10,32,32,32,32,32,32,34,114,111,108,101,34,58,32,34,85,115,101,114,34,44,10,32,32,32,32,32,32,34,101,109,97,105,108,34,58,32,34,97,46,115,97,114,107,105,115,43,98,108,111,103,49,48,48,64,101,119,101,101,118,46,99,111,109,34,10,32,32,32,32,125]

Responses

Status Description Schema
200 section type resource User
400 section type resource Error
401 Error Resource Error
404 section type resource Error

Invite a user to join your project

Invite user to project success - user exists

POST /api/v1/project/62b48275c05af805848ac515/invite_user
origin: https://c03640a4-1622-4e3c-88bb-91865ea1aaed.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAFYWRtaW5tAAAAD3NhYXNfcHJvamVjdF9pZG0AAAAYNjJiNDgyNzVjMDVhZjgwNTg0OGFjNTE1am0AAAAGc3RhdHVzbQAAAAh2ZXJpZmllZG0AAAAHdXNlcl9pZG0AAAAgOWNiMjkwMDc3ODdiNGZlNGI4MGJjZjgwZDRhMTc0M2JtAAAABnN0YXR1c20AAAAHc3VjY2Vzc24GAIudHZGBAWIAAVGA.FeATAnZFfvs8i4yZYvN4Kc31jO-hnDqZ_Aww8jfNmQk
content-type: multipart/mixed; boundary=plug_conn_test
{
  "invitation_user_email": [
    "email@eweev.com"
  ],
  "invitation_role": "webmaster"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIiiVAqaqOcR4ABAmi
access-control-allow-origin: https://c03640a4-1622-4e3c-88bb-91865ea1aaed.com
{
  "invited": [
    "email@eweev.com"
  ],
  "invalid_format": [],
  "failed_to_send": [],
  "demotion": []
}

Used to send an invitation to (existing or non existing) user emails to join your project with a specific role.

Request

POST api/v1/project/:project_id/invite_user

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
invitation_role The role to invite the users as body string true one of:webmaster,admin
invitation_emails List of emails to invite to the project body array true ['email1@gmail.com','email2@gmail.com']

Responses

Status Description Schema
200 Invitation Resource Invitation
401 Error Resource Error

Accept an invitation to join a project.

Accept invitation to project success - user exists

POST /api/v1/invitation/accept_invitation
origin: https://92943258-cd85-4479-b041-cdd6b9fbbe2c.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI1YWMwNWFmODA1ODRhZWYyMjFqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACBiZjAzMGYyMmNlN2Y0NzNlOGVmODQyMmNmYmMyYmU5Nm0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYADzEdkYEBYgABUYA.sVIn19xJYMuCDvPOW33d1iZiZJZ9DoBFXYVIVKbZJ94
content-type: multipart/mixed; boundary=plug_conn_test
{
  "invitation_token": "SFMyNTY.g2gDdAAAAANtAAAACnByb2plY3RfaWRtAAAAGDYyYjQ4MjVhYzA1YWY4MDU4NGFlZjIyMW0AAAAEcm9sZW0AAAAJd2VibWFzdGVybQAAAAp1c2VyX2VtYWlsbQAAABBlbWFpbDFAZW1haWwuY29tbgYAPTMdkYEBYgABUYA.itwHy-XUzb_N19eeNpjiJ5UHeJt6LRDmf5PulSSC8ZA"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIg8_H5l9L3wMABAgh
{
  "token": null,
  "status": null,
  "roles": null,
  "projects": [
    {
      "saas_project_id": "62b4825ac05af80584aef221",
      "role": "webmaster"
    }
  ],
  "inserted_at": null,
  "id": "43530b0a01b6478a9ba704d9403b88cc",
  "full_name": "Full name",
  "email": "email1@email.com"
}

Used to accept an invitation to join a project with a specific role.

You are expected to add the token received in the email as the token authorization header.

Request

POST /api/v1/invitation

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true

Responses

Status Description Schema
200 User Resource User
401 Error Resource Error

Verify your Sections account

Verify user

POST /api/v1/verify_user
origin: http://clientapp.com:3001
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEdXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI3ZWMwNWFmODA1ODQ3YWFiM2ZqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACAyYmYwYWViZmU2NDE0MzA0OTE0M2ZjNjI4NDM2YzNhYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAIb0dkYEBYgABUYA.LKBSLdKDAUH7TOZT2dQIiX1h1WOKcouCpCNq9mx92T0
content-type: multipart/mixed; boundary=plug_conn_test
{
  "token": "this is the token"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIjBJVbqFHBp0AA_8j
access-control-allow-origin: http://clientapp.com:3001
{
  "message": "Your email has been successfully verified."
}

Used to verify your Sections account.

You are expected to use the token received in the verification email as the token authorization header.

Request

POST api/v1/verify_user

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
origin Request Origin header string true https://your.project.url.com

Responses

Status Description Schema
200 Message resource Message
410 Error Resource Error

Get the pending invitations to a project.

Invite user to project success - user exists

GET /api/v1/project/62b48275c05af805848ac515/pending_invitations
origin: https://c03640a4-1622-4e3c-88bb-91865ea1aaed.com
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAFYWRtaW5tAAAAD3NhYXNfcHJvamVjdF9pZG0AAAAYNjJiNDgyNzVjMDVhZjgwNTg0OGFjNTE1am0AAAAGc3RhdHVzbQAAAAh2ZXJpZmllZG0AAAAHdXNlcl9pZG0AAAAgOWNiMjkwMDc3ODdiNGZlNGI4MGJjZjgwZDRhMTc0M2JtAAAABnN0YXR1c20AAAAHc3VjY2Vzc24GAIudHZGBAWIAAVGA.FeATAnZFfvs8i4yZYvN4Kc31jO-hnDqZ_Aww8jfNmQk

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIimEBF6eOcR4ABAni
access-control-allow-origin: https://c03640a4-1622-4e3c-88bb-91865ea1aaed.com
{
  "users": [
    {
      "role": "webmaster",
      "invited_at": 1655997046,
      "email": "email@eweev.com"
    }
  ],
  "total": 1
}

Used to fetch pending invitation to (existing or non existing) user emails to join your project with a specific role.

Request

GET api/v1/project/:project_id/pending_invitations

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true

Responses

Status Description Schema
200 Pending Invitation Resource Pending_Invitation
401 Error Resource Error

6. Medias

This part is dedicated to give you a clear idea on how to manage your medias. A media is an entity that holds a file that can be used across multiple sections. We can create a media using a base64 file.

Creates a media

Create a page with valid section using medias ids then keep sync

POST /api/v1/project/62b4822ac05af80584f0919e/media
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIyYWMwNWFmODA1ODRmMDkxOWVqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA3ZGZiOGI1YTU2NTc0M2IxYjNjMDhlMWZhNTExOWFlYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYASXYckYEBYgABUYA.BRDxtF413EPicEoBtzsKl4jwcvytGMoHsM9Hra6q0zk
origin: https://3b5ff702-d620-4ed4-b6c6-c886cf53c05e.com
content-type: multipart/mixed; boundary=plug_conn_test
{
  "type": "image",
  "private_status": "public",
  "locked_status": "unlocked",
  "files": {
    "1": {
      "file": {
        "path": "test/support/toggle.png",
        "filename": "blue.svg",
        "content_type": "image/svg"
      }
    }
  }
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIeIvuiPRTfZ8AA_6i
access-control-allow-origin: https://3b5ff702-d620-4ed4-b6c6-c886cf53c05e.com
{
  "type": "image",
  "title": null,
  "tags": null,
  "seo_tag": null,
  "private_status": "public",
  "number_of_contents": 0,
  "namespace": "62b4822ac05af80584f0919e",
  "locked_status": "unlocked",
  "id": "62b4822cc05af80584fa0e69",
  "files": [
    {
      "url": "https://www.fake-url.com/1ed56dd637864f4982a58c44f618487f",
      "type": "image/svg",
      "thumbnail_url": "https://www.fake-url.com/c5c4d40391754be7a4db29694b1cada1",
      "size": 3949,
      "platform_id": "611696250a998650895fdf2f",
      "metadata": {
        "width": 80,
        "height": 80
      },
      "filename": "fake_filename",
      "file_id": "fake_file_id"
    }
  ],
  "author": "7dfb8b5a565743b1b3c08e1fa5119aea"
}

Creates a media with a given file

Request

POST api/v1/project/{project_id}/media

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
id The media id query_string string true
section A map containing the file body map true {1: {file: 'BASE64_STRING_HERE', base64: true}}

Responses

Status Description Schema
200 Media resource Media
400 Error Resource Error
404 Error Resource Error

Renders a media

Create a page with valid section using medias ids then keep sync

GET /api/v1/project/62b4822ac05af80584f0919e/media/62b4822cc05af80584fa0e69
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIyYWMwNWFmODA1ODRmMDkxOWVqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA3ZGZiOGI1YTU2NTc0M2IxYjNjMDhlMWZhNTExOWFlYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYASXYckYEBYgABUYA.BRDxtF413EPicEoBtzsKl4jwcvytGMoHsM9Hra6q0zk
origin: https://3b5ff702-d620-4ed4-b6c6-c886cf53c05e.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIeQs3Gm1TfZ8AA_yj
access-control-allow-origin: https://3b5ff702-d620-4ed4-b6c6-c886cf53c05e.com
{
  "type": "image",
  "title": null,
  "tags": null,
  "seo_tag": null,
  "private_status": "public",
  "number_of_contents": 0,
  "namespace": "62b4822ac05af80584f0919e",
  "locked_status": "unlocked",
  "id": "62b4822cc05af80584fa0e69",
  "files": [
    {
      "url": "https://www.fake-url.com/1ed56dd637864f4982a58c44f618487f",
      "type": "image/svg",
      "thumbnail_url": "https://www.fake-url.com/c5c4d40391754be7a4db29694b1cada1",
      "size": 3949,
      "platform_id": "611696250a998650895fdf2f",
      "platform": {
        "width": 1000,
        "updated_at": 1628870181,
        "number_of_medias": 0,
        "namespace": "sections_app",
        "name": "Global Platform",
        "inserted_at": 1628870181,
        "id": "611696250a998650895fdf2f",
        "height": 1000,
        "description": "This is the only platform used for sections"
      },
      "metadata": {
        "width": 80,
        "height": 80
      },
      "filename": "fake_filename",
      "file_id": "fake_file_id"
    }
  ],
  "author": "7dfb8b5a565743b1b3c08e1fa5119aea"
}

Renders the media with its details.

Request

GET api/v1/project/{project_id}/media/{id}

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
id The media id query_string string true

Responses

Status Description Schema
200 Media resource Media
400 Error Resource Error
404 Error Resource Error

Renders all medias for this project.

List medias

POST /api/v1/project/62b48256c05af80584e5b75c/medias
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODI1NmMwNWFmODA1ODRlNWI3NWNqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACBmZjNkNDU0ZThhNmI0NDQ4YTg5MzVlZWUyMjFlNGUxN20AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAWyAdkYEBYgABUYA.yQkrGC95u0btgNxi6n8rCV0jNHn55U7lwtinV_5THtM
origin: https://9f6bdcc1-b325-4319-a62c-d0f0c4b266f9.com

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIgxjUSYDnzpEABAch
access-control-allow-origin: https://9f6bdcc1-b325-4319-a62c-d0f0c4b266f9.com
{
  "total": 1,
  "result": [
    {
      "type": "image",
      "title": null,
      "tags": null,
      "seo_tag": null,
      "private_status": "public",
      "number_of_contents": 0,
      "namespace": "62b48256c05af80584e5b75c",
      "locked_status": "unlocked",
      "id": "62b48257c05af805843bbaff",
      "files": [
        {
          "url": "https://www.fake-url.com/9cf87bbf99324505a574b3f8b49d983d",
          "type": "image/svg",
          "thumbnail_url": "https://www.fake-url.com/2a5693409a204bf58f5f30c9d2b4bf61",
          "size": 3949,
          "platform_id": "611696250a998650895fdf2f",
          "platform": {
            "width": 1000,
            "updated_at": 1628870181,
            "number_of_medias": 0,
            "namespace": "sections_app",
            "name": "Global Platform",
            "inserted_at": 1628870181,
            "id": "611696250a998650895fdf2f",
            "height": 1000,
            "description": "This is the only platform used for sections"
          },
          "metadata": {
            "width": 80,
            "height": 80
          },
          "filename": "fake_filename",
          "file_id": "fake_file_id"
        }
      ],
      "author": "ff3d454e8a6b4448a8935eee221e4e17"
    }
  ]
}

Renders the medias with their details.

Request

POST api/v1/project/{project_id}/medias

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true

Responses

Status Description Schema
200 Array of Media resource Media

Updates a media

Create a page with valid section using medias ids then keep sync

PUT /api/v1/project/62b4822ac05af80584f0919e/media/62b4822cc05af80584fa0e69
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAAEbQAAAAVlbWFpbGQAA25pbG0AAAAPc2Fhc19wcm9qZWN0X2lkbAAAAAF0AAAAAm0AAAAEcm9sZW0AAAAEVXNlcm0AAAAPc2Fhc19wcm9qZWN0X2lkbQAAABg2MmI0ODIyYWMwNWFmODA1ODRmMDkxOWVqbQAAAAZzdGF0dXNtAAAACHZlcmlmaWVkbQAAAAd1c2VyX2lkbQAAACA3ZGZiOGI1YTU2NTc0M2IxYjNjMDhlMWZhNTExOWFlYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYASXYckYEBYgABUYA.BRDxtF413EPicEoBtzsKl4jwcvytGMoHsM9Hra6q0zk
origin: https://3b5ff702-d620-4ed4-b6c6-c886cf53c05e.com
content-type: multipart/mixed; boundary=plug_conn_test
{
  "type": "image",
  "private_status": "public",
  "locked_status": "unlocked",
  "files": {
    "1": {
      "file": {
        "path": "test/support/toggle.png",
        "filename": "blue.svg",
        "content_type": "image/svg"
      }
    }
  }
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIeZe5QZJTfZ8AA_9C
access-control-allow-origin: https://3b5ff702-d620-4ed4-b6c6-c886cf53c05e.com
{
  "type": "image",
  "title": null,
  "tags": null,
  "seo_tag": null,
  "private_status": "public",
  "number_of_contents": 0,
  "namespace": "62b4822ac05af80584f0919e",
  "locked_status": "unlocked",
  "id": "62b4822cc05af80584fa0e69",
  "files": [
    {
      "url": "https://www.fake-url.com/6eff7f4a92834c7b8320f92cf53ff4e7",
      "type": "image/svg",
      "thumbnail_url": "https://www.fake-url.com/8f03c9fa7e8540c998dd2dbc75b14718",
      "size": 3949,
      "platform_id": "611696250a998650895fdf2f",
      "metadata": {
        "width": 80,
        "height": 80
      },
      "filename": "fake_filename",
      "file_id": "fake_file_id"
    }
  ],
  "author": "7dfb8b5a565743b1b3c08e1fa5119aea"
}

Updates a media with a given file

Request

POST api/v1/project/{project_id}/media/{id}

Parameters

Parameter Description In Type Required Default Example
project_id Your project id in Sections query_string string true
id The media id query_string string true
section A map containing the file body map true {1: {file: 'BASE64_STRING_HERE', base64: true}}

Responses

Status Description Schema
200 Media resource Media
400 Error Resource Error
404 Error Resource Error

7. Project Management

This part will guide on how to manage your project on Sections.

Update a project

Update project

PUT /api/v1/project/62b4822fc05af80584cbe1ce
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAACbQAAAAxyb2xlc19vYmplY3RsAAAAAXQAAAABbQAAAAV0aXRsZW0AAAALc3VwZXJfYWRtaW5qbQAAAAd1c2VyX2lkbQAAACAxY2QwODRlYzU5ZDY0YmU3Yjg4MDdmN2FhZWY5ZWY5ZG0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAFYkckYEBYgABUYA.Fl-Y5kQU4i5ipspu-I4E_fh3ww5eFNcX58Rsn-sAUAA
pkey: $2b$12$R.pNCug.gTHm5VSQzEyjR.LGTo4kEtslBMawcPYWKmkkXtagBCrCS
content-type: multipart/mixed; boundary=plug_conn_test
{
  "title": "New title 123"
}

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIedglV5lwuzcAA_-C
{
  "updated_at": 1655996976,
  "type": "private",
  "title": "New title 123",
  "reason": null,
  "project_url": [
    "http://localhost:3000",
    "https://345eb38e-2abd-4898-a6ca-4a5178aa8ea1.com"
  ],
  "private_key": "cvJFmN8Sjnr0puzvmFcOBuIzkqclhbnA",
  "package": "free",
  "login_redirect_url": "http://localhost:3000/redirect-login",
  "last_req_date": null,
  "inserted_at": "2022-06-23",
  "id": "62b4822fc05af80584cbe1ce",
  "files_counter": 0,
  "configured_fields": {},
  "active": true,
  "__meta__": {
    "state": "built",
    "source": "project",
    "schema": "Elixir.Sections.Section.Project",
    "prefix": null,
    "context": null
  }
}

Used to update any project field. Notes: - For the project_url and login_redirect_url fields, you can specify any of the following patterns for local testing: - localhost:PORT with HTTP:// or HTTPS:// - Class A,B,C Private addresses with HTTP://

Request

PUT api/v1/project/:project_id/

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
origin Request Origin header string true https://your.project.url.com
project Project Model. body map true {'active' => true,'configured_fields' => {'blogs' => {'private_key' => 'xxxxxx','project_id' => 1}},'files_counter' => 0,'id' => '601bf1221907a50007ba3f81','login_redirect_url' => 'https://your.project.url.com/redirect_login/admin','package' => 'free','private_key' => 'xxxxxx','project_url' => ['https://your.project.url.com'],'reason' => nil,'type' => 'private'}

Responses

Status Description Schema
200 Project Resource Project
400 Error Resource Error

Reset a Project's private key

Reset project private key

PUT /api/v1/project/62b48234c05af80584eea601/reset_key
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAACbQAAAAxyb2xlc19vYmplY3RsAAAAAXQAAAABbQAAAAV0aXRsZW0AAAALc3VwZXJfYWRtaW5qbQAAAAd1c2VyX2lkbQAAACA1MDBmMmNkYTI0YjE0ZGVmOGUwMjZkNDFmMTc0NGNiZW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAdpockYEBYgABUYA.Hz-VOq1BsF8yGt6kcpM3gI5k1WBfxVdm8eYzZItWNpo
pkey: $2b$12$Siochcq5QegGvX4umeD9weDeXvIxr5pIscg7.4gW8TcNw9od9qHiy

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIeuWK-rJnEVUABABh
{
  "message": "Your project private key was successfully reset. The old one does not work anymore. Make sure to update the private key to the new one wherever you are using it."
}

Used to reset the private key field of a project.

Request

PUT api/v1/project/:project_id/reset_key

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
origin Request Origin header string true https://your.project.url.com

Responses

Status Description Schema
200 Project Resource Project
400 Error Resource Error

Get a project's dahsboard metrics

Get project dashboard

GET /api/v1/project/62b48238c05af805846b5f9c/dashboard
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAACbQAAAAxyb2xlc19vYmplY3RsAAAAAXQAAAABbQAAAAV0aXRsZW0AAAALc3VwZXJfYWRtaW5qbQAAAAd1c2VyX2lkbQAAACBjYzVmMGRkZDVkNjA0YzdhYWNiM2E4NDIxZTdhYmViYW0AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYAiKsckYEBYgABUYA.lNAq4ay-Kpv6oVjbU7XNN0lzTdp2Z2EZF0dGuCX8W94
pkey: $2b$12$e61koeXAMHiTZzji6Gn/DeFIox7NtMmiVhdfDrLepmEpyxjeROhmm

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIe-jukfLwt94ABARC
{
  "package_name": "free",
  "max_pages": 2,
  "max_media_files": 10,
  "max_file_size": 500000,
  "current_pages": 0,
  "current_medias": 0,
  "api_until_reset": 31814498,
  "api_limit_use": 500,
  "api_current_use": 0
}

Used to retrieve a project's dashboard metrics such as package limitations and current usage.

Request

GET api/v1/project/:project_id/dashboard

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true
origin Request Origin header string true https://your.project.url.com
project Project Model. body map true {'active' => true,'configured_fields' => {'blogs' => {'private_key' => 'xxxxxx','project_id' => 1}},'files_counter' => 0,'id' => '601bf1221907a50007ba3f81','login_redirect_url' => 'https://your.project.url.com/redirect_login/admin','package' => 'free','private_key' => 'xxxxxx','project_url' => ['https://your.project.url.com'],'reason' => nil,'type' => 'private'}

Responses

Status Description Schema
200 Dashboard Resource Dashboard
400 Error Resource Error

8. Sections Admin Only Access

This part wil guide Sections Admins on actions they only can perform.

Get projects

test pagination and filtering of projects GET /api/v1/auth/project pagination limit and start

GET /api/v1/auth/project?start=1&limit=1
token: SFMyNTY.g2gDdAAAAAJtAAAABGRhdGF0AAAAAW0AAAAEdXNlcnQAAAACbQAAAAxyb2xlc19vYmplY3RsAAAAAXQAAAABbQAAAAV0aXRsZW0AAAALc3VwZXJfYWRtaW5qbQAAAAd1c2VyX2lkbQAAACAwMzczZjc5Zjk1ZjY0NGIxOTk2YTg0M2JiYTQ2Y2I4Y20AAAAGc3RhdHVzbQAAAAdzdWNjZXNzbgYA51QekYEBYgABUYA.I0hHDYNyfoCRoVcwct8qYLzSKj28b7K0za2N14CMiWo

Response

200
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
x-request-id: FvtIlSzqNi4OSX0ABAVj
access-control-allow-origin: http://clientapp.com:3001
{
  "total": 102,
  "data": [
    {
      "updated_at": 1655996970,
      "type": "private",
      "title": null,
      "reason": null,
      "project_url": [
        "https://a2e7ec9a-13dc-4b28-bc96-204897215861.com"
      ],
      "private_key": "2W-6p8SVb_sPhGFUgH1EUHQeZcKMEHSq",
      "package": "free",
      "login_redirect_url": null,
      "last_request_user": {
        "role": null,
        "full_name": null,
        "email": null
      },
      "last_req_date": 1655996970,
      "inserted_at": 1655996969,
      "id": "62b48229c05af805844ae2ca",
      "files_counter": 0,
      "configured_fields": {},
      "active": true,
      "__meta__": {
        "state": "built",
        "source": "project",
        "schema": "Elixir.Sections.Section.Project",
        "prefix": null,
        "context": null
      }
    }
  ]
}

Used to retrieve list of projects. Current supported filters are:

Request

POST api/v1/auth/projects

Parameters

Parameter Description In Type Required Default Example
token Sections Token header string true

Responses

Status Description Schema
200 List of Project Resource Project
400 Error Resource Error