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:6356ac5488ac0f0b3da4cf27
- Event: verify_fields
- Body:
{
"server_ref": "g2gFWGQADW5vbm9kZUBub2hvc3QAAANjAAAAAAAAAABkACdFbGl4aXIuUGhvZW5peC5Tb2NrZXQuVjIuSlNPTlNlcmlhbGl6ZXJtAAAAFnNlY3Rpb25fdHlwZXM6c2VjdGlvbnNhDGEB",
"ref": 12,
"params": {
"project_id": "6356ac5488ac0f0b3da4cf28",
"authorization_fields": {
"project_id": "38",
"private_key": "yAEgYqLn7K-qDtVPKxAdSuLJAATZwjdm"
},
"app_id": "6356ac5488ac0f0b3da4cf27"
}
}
Upserting authorization fields
Message
- Topic: section_types:6356ac5488ac0f0b3da4cf27
- Event: verify_fields_reply
- Body:
{
"status_code": 200,
"status": "success",
"server_ref": "g2gFWGQADW5vbm9kZUBub2hvc3QAAANjAAAAAAAAAABkACdFbGl4aXIuUGhvZW5peC5Tb2NrZXQuVjIuSlNPTlNlcmlhbGl6ZXJtAAAAFnNlY3Rpb25fdHlwZXM6c2VjdGlvbnNhDGEB",
"ref": 12,
"data": {
"message": "Credentials are valid"
}
}
Upserting authorization fields failure
Message
- Topic: section_types:6356ac3388ac0f0b3d4033f9
- Event: verify_fields_reply
- Body:
{
"status_code": 401,
"status": "failed",
"server_ref": "g2gFWGQADW5vbm9kZUBub2hvc3QAAANjAAAAAAAAAABkACdFbGl4aXIuUGhvZW5peC5Tb2NrZXQuVjIuSlNPTlNlcmlhbGl6ZXJtAAAAFnNlY3Rpb25fdHlwZXM6c2VjdGlvbnNhA2EB",
"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
- Topic: section_types:6356ac4b88ac0f0b3d92983c
- Event: render
- Body:
{
"server_ref": "g2gFWGQADW5vbm9kZUBub2hvc3QAAANjAAAAAAAAAABkACdFbGl4aXIuUGhvZW5peC5Tb2NrZXQuVjIuSlNPTlNlcmlhbGl6ZXJtAAAAFnNlY3Rpb25fdHlwZXM6c2VjdGlvbnNhCWEB",
"ref": 9,
"params": {
"type": {
"type": "configurable",
"region": "main",
"project_id": "6356ac4c88ac0f0b3d0ae645",
"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": "6356ac4b88ac0f0b3d92983c",
"application": "title",
"access": "public_scoped"
},
"project": {
"type": "private",
"title": "title",
"reason": null,
"project_url": [
"https://2107af8a-2984-4743-83c8-15b74c46b029.com"
],
"package": {
"type": "public",
"project_id": null,
"price": null,
"name": "free",
"limits": [
{
"value": 0,
"name": "query_string_support",
"label": "Query string support for dynamic pages"
},
{
"value": 2,
"name": "number_of_pages",
"label": "Max number of pages"
},
{
"value": 1,
"name": "variation_per_page",
"label": "Max number of variation page"
},
{
"value": 5,
"name": "static_sections",
"label": "Max number of static section types that can be declared"
},
{
"value": 5,
"name": "sections_total",
"label": "Max number of sections per page"
},
{
"value": 10,
"name": "hosted_files",
"label": "Max number of files hosted"
},
{
"value": 500000,
"name": "size_per_file",
"label": "Maximum Size Per File (in bytes)"
},
{
"value": 10,
"name": "api_limit_sec",
"label": "API rate limit per second"
},
{
"value": 100,
"name": "api_limit_minute",
"label": "API rate limit per minute"
},
{
"value": -1,
"name": "api_limit_hour",
"label": "API rate limit per hour"
},
{
"value": 500,
"name": "api_limit_day",
"label": "API rate limit per day"
}
],
"label": "Free",
"currency": "EUR"
},
"login_redirect_url": null,
"last_req_date": null,
"id": "6356ac4c88ac0f0b3d0ae645",
"files_counter": 0,
"configured_fields": {
"6356ac4b88ac0f0b3d92983c": {
"project_id": 11,
"private_key": "pkey"
}
},
"active": true
},
"option": {
"articles_ids": [
"1"
]
},
"context": {
"query_string": null,
"project_id": "6356ac4c88ac0f0b3d0ae645",
"authorization_fields": {
"project_id": 11,
"private_key": "pkey"
}
}
}
}
Rendering a section
Message
- Topic: section_types:6356ac4b88ac0f0b3d92983c
- Event: render_reply
- Body:
{
"status_code": 200,
"status": "success",
"server_ref": "g2gFWGQADW5vbm9kZUBub2hvc3QAAANjAAAAAAAAAABkACdFbGl4aXIuUGhvZW5peC5Tb2NrZXQuVjIuSlNPTlNlcmlhbGl6ZXJtAAAAFnNlY3Rpb25fdHlwZXM6c2VjdGlvbnNhCWEB",
"ref": 9,
"data": [
{
"title": "Article 1",
"id": 1
}
]
}
Section will broadcast a config_values
message asking for the options of a configurable section type decalred by your third party app.
Broadcast
- Topic: section_types:6356ac4788ac0f0b3df1c23f
- Event: config_values
- Body:
{
"server_ref": "g2gFWGQADW5vbm9kZUBub2hvc3QAAANjAAAAAAAAAABkACdFbGl4aXIuUGhvZW5peC5Tb2NrZXQuVjIuSlNPTlNlcmlhbGl6ZXJtAAAAFnNlY3Rpb25fdHlwZXM6c2VjdGlvbnNhB2EB",
"ref": 7,
"params": {
"type": {
"type": "configurable",
"region": "main",
"project_id": "6356ac4788ac0f0b3df1c240",
"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": "6356ac4788ac0f0b3df1c23f",
"application": "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:6356ac4788ac0f0b3df1c23f
- Event: config_values_reply
- Body:
{
"server_ref": "g2gFWGQADW5vbm9kZUBub2hvc3QAAANjAAAAAAAAAABkACdFbGl4aXIuUGhvZW5peC5Tb2NrZXQuVjIuSlNPTlNlcmlhbGl6ZXJtAAAAFnNlY3Rpb25fdHlwZXM6c2VjdGlvbnNhB2EB",
"ref": 7,
"data": [
{
"option_values": [
{
"title": "Article 1",
"id": 1
},
{
"title": "Article 2",
"id": 2
}
],
"field": "article_ids"
}
]
}
/n