siddhistream-processingwso2-streaming-integrator

How to perform a GET API call in WSO2SP


How do I perform a GET API call in WSO2 Stream Processor? Is there any working example that I can use as a reference?

All the examples I've seen show only a POST call. Is there any difference in the way it is done apart from changing the "method" parameter from POST to GET?

This is a sample code.

@sink(type='http-request', sink.id='sample', publisher.url='http://<host>:<port>/parse?q={{q}}&a={{a}}&b={{b}}', method='GET', @map(type='json', @payload("{'q':{{q}}, 'project':{{project}}, 'model':{{model}}}"))) 
define stream interstream(q string, a string, b string);

@source(type='http-response', sink.id='sample') 
define stream outputstream(message string);

Solution

  • No, you simply have to change the method param only.