The parameters in the API are confusing, especially the depth + the json
paramter.
I have seen these three combinations and my question is, which variant is wrong and which is not.
I can't figure out from the results what exactly is going on as most of my queries don't yet return what I'm expecting, so I want to get this clear first. I think Civi has some kind of fallback magic as in some requests I get undefined_fields
but it returns correct results.
Entity related stuff goes into the root level, as seen in different (inofficial) files:
{
'api_key': '...',
'activity.id': 123,
'json': {
'options': {
'limit': 1
}
}
}
The API Explorer suggest entity/attribute related stuff goes inside the json
parameter:
{
'api_key': '...',
'json': {
'activity.id': 123,
'options': {
'limit': 1
}
}
}
Variant without nesting and json
beeing integer as seen on https://docs.civicrm.org/dev/en/latest/api/usage/ :
{
'api_key': '...',
'activity.id': 123,
'limit': 1
'json': 1
}
P.S I'm accessing the REST API via HTTP calls to /sites/all/modules/civicrm/extern/rest.php
.