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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1QAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQRhAQ==",
  "ref": 4,
  "params": {
    "project_id": "65ec019d84307f082641c903",
    "authorization_fields": {
      "project_id": "38",
      "private_key": "z0kjqEYU1yRnrXKvb_DkuESJadMuK5MC"
    },
    "app_id": "65ec019c84307f08269823e2"
  }
}

Upserting authorization fields

Message

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

Upserting authorization fields failure

Message

{
  "status_code": 401,
  "status": "failed",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1QAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQZhAQ==",
  "ref": 6,
  "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1QAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQVhAQ==",
  "ref": 5,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "65ec019e84307f08265f57e5",
      "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": "65ec019e84307f08265f57e5",
      "application": "App Title",
      "access": "public_scoped"
    },
    "project": {
      "type": "private",
      "title": "title",
      "reason": null,
      "project_url": [
        "2378268a-0810-47f6-b504-b06e0278733d.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": 2,
            "name": "users"
          },
          {
            "value": 2,
            "name": "domains"
          }
        ],
        "label": "Free",
        "currency": "EUR"
      },
      "login_redirect_url": null,
      "limitation_status": "active",
      "last_req_date": null,
      "id": "65ec019e84307f08265f57e6",
      "files_counter": 0,
      "configured_fields": {
        "65ec019e84307f08265f57e5": {
          "project_id": 11,
          "private_key": "pkey"
        }
      },
      "billing_status": "upgrade_lock",
      "active": true
    },
    "option": {
      "articles_ids": [
        "1"
      ]
    },
    "context": {
      "query_string": {},
      "project_id": "65ec019e84307f08265f57e6",
      "authorization_fields": {
        "project_id": 11,
        "private_key": "pkey"
      }
    }
  }
}

Rendering a section

Message

{
  "status_code": 200,
  "status": "success",
  "server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1QAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQVhAQ==",
  "ref": 5,
  "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1QAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQlhAQ==",
  "ref": 9,
  "params": {
    "type": {
      "type": "configurable",
      "region": {},
      "project_id": "65ec01aa84307f082636d1a9",
      "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": "65ec01aa84307f082636d1a8",
      "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": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1QAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQlhAQ==",
  "ref": 9,
  "data": [
    {
      "option_values": [
        {
          "title": "Article 1",
          "id": 1
        },
        {
          "title": "Article 2",
          "id": 2
        }
      ],
      "field": "article_ids"
    }
  ]
}
/n