The following example will allow you to update the no-index value for a single page. There is currently no option to set no-index for all pages within a single call.
Things you will need
1. Domain name. When using the site API, any requests must be sent to http://{subdomain}.{tool-domain}/api.php/endpoint. e.g. http://demoapi.editortool.companyabc.com/api.php/login
Login
Before we can use the site API, we’ll need to log into the individual site. This can be done via either of the following API calls:
1. Site API (requires username and password)
POST http://demoapi.editortool.companyabc.com/api.php/login { "username": "apidemo", "password": "apidemo123" }
Response:
{ "sessionId": "{session ID}", "message": "Set as cookie value for site_session", "sessionName: "site_session" }
2. HAL API (requires a token)
POST https://hal.mono.net/api/v1/reseller/account/site { "userToken": "{your-token}", "command": "apiLogin", "siteId": {your site ID} }
Response:
{ "status": { "code": 200, "text": "", "timeStamp": "2017-08-21T12:21:31+00:00" }, "data": [ { "sessionName": "site_session", "sessionId": "{session ID}" } ] }
Both calls will yield a session ID in the format 35 character alphanumeric. In any future calls we make, we must include the header 'Cookie=site_session={session ID}'.
Get all existing pages
GET http://demoapi.editortool.companyabc.com/api.php/website/pages
Response:
[ { "pages": [ { "id": "p2374", "name": "home", ... "noIndex": "" }, { "id": "p1879", "name": "services", ... "noIndex": "" }, ... { "id": "p2471", "name": "test-slettes", "noIndex": "true" } ], "limit": -1 } ]
Update a page's no-index value
We can use the page ID from the previous request to perform a RESTful PATCH and update the page's no-index setting.
PATCH http://demoapi.editortool.companyabc.com/api.php/website/locales/p1879 { "no-index": "true" }
Response:
[]