API Documentation

Socket API

Sections will broadcast a verify_fields event with the authroziation fields in the body. Theses fields should validated by the app and return the result. Make sure to reutrn a status code 401 in case the fields are not valid.

Broadcast

{
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1kAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQZhAQ==",
  "ref": 6,
  "params": {
    "project_id": "6747911984307f077928ed4d",
    "authorization_fields": {
      "project_id": "38",
      "private_key": "SzDfUB2aWzOCHn-8g68IphQ9UvqR8MNX"
    },
    "app_id": "6747911984307f077928ed4c"
  }
}

Upserting authorization fields

Message

{
  "status_code": 200,
  "status": "success",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1kAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQZhAQ==",
  "ref": 6,
  "data": {
    "message": "Credentials are valid"
  }
}

Upserting authorization fields failure

Message

{
  "status_code": 401,
  "status": "failed",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1kAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQphAQ==",
  "ref": 10,
  "data": null
}

Sections will broadcast a message render asking for a decalred section type by your app. The body below shows exactly how sections asks for a configurable section type. For a dynamic section type the options will not be included.

Broadcast

{
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1kAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQRhAQ==",
  "ref": 4,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "6747910f84307f07797da7b5",
      "options": true,
      "name": "selective_articles",
      "fields": [
        {
          "type": "integer",
          "name": "articles_ids",
          "key": "articles_ids"
        }
      ],
      "authorized_projects": null,
      "authorization_fields": [
        "private_key",
        "project_id"
      ],
      "author_id": null,
      "application_id": "6747910f84307f07797da7b5",
      "application": "App Title",
      "access": "public_scoped"
    },
    "project": {
      "type": "private",
      "title": "title",
      "reason": null,
      "project_url": [
        "a8233ed2-b576-4e66-ac01-26a0cb7de1e7.com"
      ],
      "private_packages": null,
      "private_key": "KKPX6MdDzPkk1hneUydC87YOolFKjBVi",
      "package": {
        "type": "public",
        "rank": 0,
        "quota": -1,
        "project_id": null,
        "price": 0,
        "name": "free",
        "locked": false,
        "limits": [
          {
            "value": 0,
            "name": "query_string_support"
          },
          {
            "value": 2,
            "name": "number_of_pages"
          },
          {
            "value": 1,
            "name": "variation_per_page"
          },
          {
            "value": 5,
            "name": "static_sections"
          },
          {
            "value": 5,
            "name": "sections_total"
          },
          {
            "value": 10,
            "name": "hosted_files"
          },
          {
            "value": 500000,
            "name": "size_per_file"
          },
          {
            "value": 10,
            "name": "api_limit_sec"
          },
          {
            "value": 100,
            "name": "api_limit_minute"
          },
          {
            "value": -1,
            "name": "api_limit_hour"
          },
          {
            "value": 500,
            "name": "api_limit_day"
          },
          {
            "value": 0,
            "name": "dynamic_section_types_support"
          },
          {
            "value": 2,
            "name": "users"
          },
          {
            "value": 2,
            "name": "domains"
          }
        ],
        "label": "Free",
        "currency": "EUR"
      },
      "login_redirect_url": null,
      "limitation_status": "active",
      "last_req_date": null,
      "id": "6747910f84307f07797da7b6",
      "files_counter": 0,
      "configured_fields": {
        "6747910f84307f07797da7b5": {
          "project_id": 11,
          "private_key": "pkey"
        }
      },
      "billing_status": "upgrade_lock",
      "active": true
    },
    "option": {
      "articles_ids": [
        "1"
      ]
    },
    "context": {
      "query_string": {},
      "project_id": "6747910f84307f07797da7b6",
      "base_path": "",
      "authorization_fields": {
        "project_id": 11,
        "private_key": "pkey"
      }
    }
  }
}

Rendering a section

Message

{
  "status_code": 200,
  "status": "success",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1kAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQRhAQ==",
  "ref": 4,
  "data": [
    {
      "title": "Article 1",
      "id": 1
    }
  ]
}

Section will broadcast a config_values message asking for the options of a configurable section type declared by your third party app.

Broadcast

{
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1kAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQhhAQ==",
  "ref": 8,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "6747911d84307f077947eeeb",
      "options": true,
      "name": "selective_articles",
      "fields": [
        {
          "type": "integer",
          "name": "articles_ids",
          "key": "articles_ids"
        }
      ],
      "authorized_projects": null,
      "authorization_fields": [
        "private_key",
        "project_id"
      ],
      "author_id": null,
      "application_id": "6747911d84307f077947eeea",
      "application": "App Title",
      "access": "public_scoped"
    },
    "context": {
      "authorization_fields": {
        "project_id": 11,
        "private_key": "pkey"
      }
    }
  }
}

Returning the options of a configurable section type to Sections

Message

{
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1kAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQhhAQ==",
  "ref": 8,
  "data": [
    {
      "option_values": [
        {
          "title": "Article 1",
          "id": 1
        },
        {
          "title": "Article 2",
          "id": 2
        }
      ],
      "field": "article_ids"
    }
  ]
}
/n