I played around with the ApiExplorer for API4 While the doc says default select would be * it doesn't return all contact details. So I added the SELECT for phone_primary and email_primary and joined the phoneDB. This worked for one phonenumber, but all the other phonenumber which can be set for a contact (e.g. fax,mobile) don't show up.
Anyway, I tried to use the curl example from the ApiExplorer and it worked so far it returns all contacts and a lot senseless details. However, limit the request is not working at all. It always returns all contacts. Also phone and email are always missing no matter what I do.
My Postman request looks like this:
https://demo.circle-interactive.co.uk/civicrm/ajax/api4/Contact/get?select= ["email_primary.", "phone.", "first_name", "last_name", "phone.mobile_provider_id", "organization_name"]&join= [["Phone AS phone", "LEFT"]]&limit=5
This are my params in Postman: {"select": ["email_primary.", "phone.", "first_name", "last_name", "phone.mobile_provider_id", "organization_name"], "join": [["Phone AS phone", "LEFT"]],
"limit": 5}
This is what API-Explorer shows as valid curl example. But it's not working as curl or Postman request. As mentioned a lot senseless contact details are returned but phone and email are always missing in the result.
CRM_URL='https://demo.circle-interactive.co.uk/civicrm/ajax/api4/Contact/get' CRM_AUTH='X-Civi-Auth: Bearer MY_API_KEY'
curl -X POST -H "$CRM_AUTH" "$CRM_URL"
-d 'params=%7B%22select%22%3A%5B%22email_primary.%2a%22%2C%22phone.%2a%22%2C%22first_name%22%2C%22last_name%22%2C%22phone.mobile_provider_id%22%2C%22organization_name%22%5D%2C%22join%22%3A%5B%5B%22Phone%20AS%20phone%22%2C%22LEFT%22%5D%5D%2C%22limit%22%3A5%7D'
While emails and phonenumber are returned in the ApiExplorer for API3 with a similar request, the curl example for API3 is not working at all. (Invalid url)
I don't get it where the problem is. Are this ApiExplorer examples still up to date? Any suggestions?