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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1wAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQZhAQ==",
  "ref": 6,
  "params": {
    "project_id": "66ec5fb2c05af8079b74fefc",
    "authorization_fields": {
      "project_id": "38",
      "private_key": "oPAu8TZuO8IMO1C-CiIq38hKUNb1o3xv"
    },
    "app_id": "66ec5fb2c05af8079b74fefb"
  }
}

Upserting authorization fields

Message

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

Upserting authorization fields failure

Message

{
  "status_code": 401,
  "status": "failed",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1wAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQVhAQ==",
  "ref": 5,
  "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1wAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQthAQ==",
  "ref": 11,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "66ec5fbfc05af8079b4ca6b1",
      "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": "66ec5fbfc05af8079b4ca6b1",
      "application": "App Title",
      "access": "public_scoped"
    },
    "project": {
      "type": "private",
      "title": "title",
      "reason": null,
      "project_url": [
        "1f062288-4bce-4c6c-a9e8-285067e560ca.com"
      ],
      "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": 1,
            "name": "users"
          },
          {
            "value": 2,
            "name": "domains"
          }
        ],
        "label": "Free",
        "currency": "EUR"
      },
      "login_redirect_url": null,
      "limitation_status": "active",
      "last_req_date": null,
      "id": "66ec5fbfc05af8079b4ca6b2",
      "files_counter": 0,
      "configured_fields": {
        "66ec5fbfc05af8079b4ca6b1": {
          "project_id": 11,
          "private_key": "pkey"
        }
      },
      "billing_status": "upgrade_lock",
      "active": true
    },
    "option": {
      "articles_ids": [
        "1"
      ]
    },
    "context": {
      "query_string": {},
      "project_id": "66ec5fbfc05af8079b4ca6b2",
      "authorization_fields": {
        "project_id": 11,
        "private_key": "pkey"
      }
    }
  }
}

Rendering a section

Message

{
  "status_code": 200,
  "status": "success",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1wAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQthAQ==",
  "ref": 11,
  "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1wAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQhhAQ==",
  "ref": 8,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "66ec5fbbc05af8079b1fb998",
      "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": "66ec5fbbc05af8079b1fb997",
      "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1wAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQhhAQ==",
  "ref": 8,
  "data": [
    {
      "option_values": [
        {
          "title": "Article 1",
          "id": 1
        },
        {
          "title": "Article 2",
          "id": 2
        }
      ],
      "field": "article_ids"
    }
  ]
}
/n