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
- Topic: section_types:673e0f1188ac0f071b2dd128
- Event: verify_fields
- Body:
{
"server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQVhAQ==",
"ref": 5,
"params": {
"project_id": "673e0f1188ac0f071b2dd129",
"authorization_fields": {
"project_id": "38",
"private_key": "b2sUy2PPc88DY3XwWE0BWrTckzSdJaob"
},
"app_id": "673e0f1188ac0f071b2dd128"
}
}
Upserting authorization fields
Message
- Topic: section_types:673e0f1188ac0f071b2dd128
- Event: verify_fields_reply
- Body:
{
"status_code": 200,
"status": "success",
"server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQVhAQ==",
"ref": 5,
"data": {
"message": "Credentials are valid"
}
}
Upserting authorization fields failure
Message
- Topic: section_types:673e0f0f88ac0f071b343bb4
- Event: verify_fields_reply
- Body:
{
"status_code": 401,
"status": "failed",
"server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQRhAQ==",
"ref": 4,
"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
- Topic: section_types:673e0f1d88ac0f071bffe601
- Event: render
- Body:
{
"server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQhhAQ==",
"ref": 8,
"params": {
"type": {
"type": "configurable",
"region": {},
"project_id": "673e0f1d88ac0f071bffe601",
"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": "673e0f1d88ac0f071bffe601",
"application": "App Title",
"access": "public_scoped"
},
"project": {
"type": "private",
"title": "title",
"reason": null,
"project_url": [
"628daa68-8866-44e9-88ef-16ee262573f8.com"
],
"private_key": "Ij7aM5urKvqQccSkJjdklQVrKsERYRnC",
"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": "673e0f1d88ac0f071bffe602",
"files_counter": 0,
"configured_fields": {
"673e0f1d88ac0f071bffe601": {
"project_id": 11,
"private_key": "pkey"
}
},
"billing_status": "upgrade_lock",
"active": true
},
"option": {
"articles_ids": [
"1"
]
},
"context": {
"query_string": {},
"project_id": "673e0f1d88ac0f071bffe602",
"base_path": "",
"authorization_fields": {
"project_id": 11,
"private_key": "pkey"
}
}
}
}
Rendering a section
Message
- Topic: section_types:673e0f1d88ac0f071bffe601
- Event: render_reply
- Body:
{
"status_code": 200,
"status": "success",
"server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQhhAQ==",
"ref": 8,
"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
- Topic: section_types:673e0f1488ac0f071be064d0
- Event: config_values
- Body:
{
"server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQZhAQ==",
"ref": 6,
"params": {
"type": {
"type": "configurable",
"region": {},
"project_id": "673e0f1488ac0f071be064d1",
"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": "673e0f1488ac0f071be064d0",
"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
- Topic: section_types:673e0f1488ac0f071be064d0
- Event: config_values_reply
- Body:
{
"server_ref": "g2gFWHcNbm9ub2RlQG5vaG9zdAAAA1sAAAAAAAAAAHcnRWxpeGlyLlBob2VuaXguU29ja2V0LlYyLkpTT05TZXJpYWxpemVybQAAABZzZWN0aW9uX3R5cGVzOnNlY3Rpb25zYQZhAQ==",
"ref": 6,
"data": [
{
"option_values": [
{
"title": "Article 1",
"id": 1
},
{
"title": "Article 2",
"id": 2
}
],
"field": "article_ids"
}
]
}
/n