viaQuery

Declare that a parameter will be transmitted to the API through the query string.

It will be serialized as part of a JSON object, and will go through URL serialization. The serialization format is not customizable.

There are currently two kinds of symbol to do this: viaQuery and queryParam. viaQuery should be applied to the parameter itself, while queryParam is applied to the function. queryParam was introduced long before the D language for UDAs on parameters (introduced in DMD v2.082.0), and will be deprecated in a future release.

@safe
viaQuery
(
string field
)

Parameters

field string

The field name to use.

// For a call to postData("D is awesome"), the server will receive the query:
// POST /data?test=%22D is awesome%22
void postData(@viaQuery("test") string data);

Meta