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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQthAQ==",
  "ref": 11,
  "params": {
    "project_id": "6765887fe038d108c8bb1534",
    "authorization_fields": {
      "project_id": "38",
      "private_key": "SnipkzEYYFKgyErrLL6KJZ-9v43E-eAx"
    },
    "app_id": "6765887fe038d108c8bb1533"
  }
}

Upserting authorization fields

Message

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

Upserting authorization fields failure

Message

{
  "status_code": 401,
  "status": "failed",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQNhAQ==",
  "ref": 3,
  "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQxhAQ==",
  "ref": 12,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "67658881e038d108c82eaec3",
      "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": "67658881e038d108c82eaec3",
      "application": "App Title",
      "access": "public_scoped"
    },
    "project": {
      "type": "private",
      "title": "title",
      "reason": null,
      "project_url": [
        "000c0274-5ab3-4270-b900-40532329b0a3.com"
      ],
      "private_packages": null,
      "private_key": "q7LhIuLjTIpVSFIpk3p_TEbw9A2ZK_ce",
      "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"
      },
      "metadata": {},
      "login_redirect_url": null,
      "limitation_status": "active",
      "last_req_date": null,
      "id": "67658881e038d108c82eaec4",
      "files_counter": 0,
      "configured_fields": {
        "67658881e038d108c82eaec3": {
          "project_id": 11,
          "private_key": "pkey"
        }
      },
      "billing_status": "upgrade_lock",
      "active": true
    },
    "option": {
      "articles_ids": [
        "1"
      ]
    },
    "context": {
      "query_string": {},
      "project_id": "67658881e038d108c82eaec4",
      "base_path": "",
      "authorization_fields": {
        "project_id": 11,
        "private_key": "pkey"
      }
    }
  }
}

Rendering a section

Message

{
  "status_code": 200,
  "status": "success",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQxhAQ==",
  "ref": 12,
  "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQphAQ==",
  "ref": 10,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "6765887ee038d108c83ebd66",
      "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": "6765887ee038d108c83ebd65",
      "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQphAQ==",
  "ref": 10,
  "data": [
    {
      "option_values": [
        {
          "title": "Article 1",
          "id": 1
        },
        {
          "title": "Article 2",
          "id": 2
        }
      ],
      "field": "article_ids"
    }
  ]
}
/n