Contact API Returns Dataset or Status
Sometimes the v2.2 API calls (done via API token and auth built on the PHP class from your sampleApplication.php on GitHub) to get a specific Contact returns the user's fieldset, and sometimes it returns an object with a State of either 'Waiting' or 'Complete'.
I've tried adding ?$async=false but it doesn't seem to change anything. Matter of fact, when I added $async=false&$select='First name','Last name' (as mentioned here in the forums, previously) I got a 400 bad request.
It seems like sometimes the API kicks butt and returns everything I need instantly, but other times it sends a Status of either Complete or Waiting with a resultUrl. Because cURL thinks it got a response, my code moves on.
Using PHP, what is your recommended way of continuing to poll the API until the dataset is ready and retrieved? Sleep for a few seconds then use the ::makeRequest() method on the ResultUrl? I'd love to see some official recommendations for what to do in instances where your API needs more time.
-
wa commented
Based on my experience, you can use the batch API (.../contacts) with $filter=Id eq {contactId} and then specify the fields you want in $select. Try it in SwaggerHub (or Postman). At least then you have the ability to poll until the result is available.
-
Rob G commented
Looking more closely at the SwaggerHub link, I see that calling for a specific Contact doesn't seem to allow for those async and select parameters. So what do you suggest people do when the system returns a State object instead when looking for an INDIVIDUAL contact? I just want a few pieces of info, is it possible to $select or $filter on a single contact but that's just undocumented?
-
Rob G commented
We've tried using Integromat in case the integration was better there, but it hangs on requests, too.