I have a callout to an API that responds with a job number. With that job number as a parameter I keep polling an endpoint, and basically receive a PENDING response until their server compiles an NDJSON file, at which point I get a SUCCESS response (and a url to the file).
I've been researching how to poll the API in apex, as it could take anywhere from sub one second to about a minute. A response to this post refers to the Continuation class and API Streaming but I've been going through documentation and examples and neither seem to be a good fit (re: Continuation - it's not a long wait for a response necessarily, I'm waiting for a specific response, and it doesn't look configurable for that - re: API Streaming - I'm the client in this situation, wouldn't this need to be initiated by the server?)
The other option mentioned is using a setTimeout function in JavaScript, but wondering if there's an apex approach I'm missing. Thanks for any help.