Passing Query Parameters in Ballerina HTTP Client

112 Views Asked by At

In Ballerina HTTP client, we can send requests using the following syntax:

Album[] albums = check albumClient->/albums;

But if we need to send query parameters with this request like this:

albums?genre=pop

How can we do this with the above syntax?

1

There are 1 best solutions below

0
On BEST ANSWER

This can be done similar to how you pass named parameters into a method:

Album[] albums = check albumClient->/albums(genre = pop);

See the relevant Ballerina By Example here.