Shell
curl -X GET 'https://www.example.com/cdna-api/pages/page/1885' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'X-Body-Has-Parameters: 1' \
--header 'Content-Type: text/plain' \
--data-binary '{id,name,fullPath,activeRevision{id,layout{id,name}}}'
What this documentation site answered to the three ways of sending it:
| Body and header | Answer |
| The selector, with the header | {"result":"success","data":{"id":1885,"name":"API sandbox","fullPath":"/api-sandbox","activeRevision":{"id":3447,"layout":{"id":30,"name":"Hub Page Sections"}}}}, the same as the selector in the query string |
| The selector, without the header | The full default record: the header is what tells the API to read the body as the selector |
properties={id,name} (without its outer braces), with the header | 500, "Could not decode properties={id,name} as GraphQL query": the body must be the bare selector, braces included |
The same request from Python, with the filters left in the URL:
python
import os, requests
selector = '{id,name,fullPath,activeRevision{id,layout{id,name},areasContent}}'
response = requests.get(
os.environ['COREDNA_URL'] + '/cdna-api/pages/pages',
params={'parent.id': 72, 'limit': 50, 'orderBy': 'position:ASC'}, # still in the query string
data=selector, # the body: the selector only
headers={
'Authorization': 'Bearer ' + os.environ['COREDNA_TOKEN'],
'X-Body-Has-Parameters': '1',
'Content-Type': 'text/plain',
'Accept': 'application/json',
},
timeout=30,
)
response.raise_for_status()
pages = response.json()['data']