Param
The general format for a param tag is as follows:
Arguments
where: specifies where the argument comes from. This can be path, query, etc.
Here's an example of how you might use where::
In this example, variable is an argument that will be obtained from the path.
Have a look at the function arguments section for more information.
The type: part specifies the datatype of the argument. This can be string, number, etc. This determines how the argument will be interpreted by the function.
It's useful to specify the type here, as it will be automatically converted to the correct type, or throw an error to the user if it's invalid.
In this example, id is an argument that will be obtained from the query string and interpreted as an number.
Have a look at the function arguments section for more information.
The name: part specifies the name of the argument. This is the identifier that will be used to reference the argument in your function.
This MUST be the same as the name of the argument in your function. If it's not, the argument will not be passed to your function.
In this example, authorization is an argument that will be obtained from the header and passed to the function parameter authorization.
The contentType: part specifies the content type of the argument. This is only used for body arguments.
In this example, body is an argument that will be obtained from the body of the request and interpreted as a json object.
Flags
There are additional optional flags that can be used to provide more information about the parameters.
This flag signifies that the parameter is not required.
In this example, id is an optional argument.