3

Is it possible to call an external api (RESTful) inside apache flink code. If it is possible then how we can do that.

I am calling an api from simple java code, it is working fine but when i use the same code in apache flink, it throws an exception :

java.io.IOException: Server returned HTTP response code: 500 for URL: http://example.com/someapi

1 Answer 1

1

Is it possible to call an external api (RESTful) inside apache flink code. If it is possible then how we can do that.

You can use the Async I/O feature provided in Flink Streaming API. Flink’s Async I/O API allows users to use asynchronous request clients with data streams. More details and examples here.

java.io.IOException: Server returned HTTP response code: 500 for URL: http://example.com/someapi

This seems to non-flink error since the response is 500. Check the request headers/parameters that is being sent and verify if the http request is being properly created. Try some utilities like PostMan to test the API first.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.