# Parameter

## Description

An Action may read inputs coming from a client request, which can contain supporting data and may be used when running the Action.

There are two types available:

1. **Query**: Short key-value pairs that comes as part of the URL. For instance, `/posts?page=2&per_page=10`
2. **Body**: More complex or large data may appear as part of the client request, and are usually in the form of **text** or **json**.

## Example use case

* Filter products by category, price range, or availability.
* Retrieve a sorted list of items, such as sorting products by name or date added.
* Send user details in the request body for the server to create a new account.

## How to use

1. Open the **Parameter** tab.
2. On the **Query** sub-tab, you can add, edit or remove Queries for your Action, which may contain:
   * **Parameter**: the query key to look for.
   * **Description**: an optional, short explanation of what the parameter is.
   * **Type**: the data type of the parameter, can be either **String**, **Number**, **Boolean** or **List**.
   * **Required**: whether the parameter is required or not. ![](https://489318254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKpIso420Eq6T1MZWmK3R%2Fuploads%2Fgit-blob-afc6860611ea9322c2322870efe27e36258e672d%2FParameter-query.png?alt=media)
3. On the **Body** sub-tab, you can set a type for the body, which can be in form of:
   * **text**: Read the full text of the body.
   * **json**: Read the body as a JSON. You can specify **Parameter**, **Description**, **Type** and **Required** in the similar manner as setting up Query. ![](https://489318254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKpIso420Eq6T1MZWmK3R%2Fuploads%2Fgit-blob-fd284712a3c7fc2044b684b138d0532ecaf6698d%2FParameter-body.png?alt=media)
4. Inside Action Flow, you can read the contents coming from Query and Body by selecting the desired parameter types.
   * Select **query** to read all contents of the Query as an object.\
     ![](https://489318254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKpIso420Eq6T1MZWmK3R%2Fuploads%2Fgit-blob-ab04122e0ae019bef6b8ff6128f8226334e22f36%2FParameter-flow-query.png?alt=media)
   * Select **queryField** to read a single value of the Query. You'll need to specify the key to read.\
     ![](https://489318254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKpIso420Eq6T1MZWmK3R%2Fuploads%2Fgit-blob-e7fac335c3dfc5caa7041ded12cf6ccd1a9cf4b2%2FParameter-flow-queryfield.png?alt=media)
   * Select **body** to read all contents of the Body. For type **text**, the value will be a string, while for **json**, the value will be an object.\
     ![](https://489318254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKpIso420Eq6T1MZWmK3R%2Fuploads%2Fgit-blob-c41d5f9d9a63671fe0e46aeaab43d4fde5ee242a%2FParameter-flow-body.png?alt=media)
   * Select **bodyField** to read a single value of the Body by its key. Note that this is only applicable for body type **json**.\
     ![](https://489318254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKpIso420Eq6T1MZWmK3R%2Fuploads%2Fgit-blob-a2d905e943981c9aa433210ac07bb7cbe4f8ae51%2FParameter-flow-bodyfield.png?alt=media)
