# URL

## Introduction

The endpoint `URL` page is used to define the HTTP method and URL to be used, and any required/optional URL parameters:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fs9ZKeoEoyjpcR07xg4pv%2Fendpoint%20-%20url.png?alt=media&#x26;token=e4b857ee-c827-47b1-b8ec-91ba0fd57c37" alt=""><figcaption></figcaption></figure></div>

## Endpoint URL

To add an endpoint URL, you must select the appropriate `HTTP method`:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fsq9yHrkxUSY5ZNVorEqu%2Fendpoint%20-%20url%202.png?alt=media&#x26;token=9be3684a-093a-49d4-8d0f-37dd5801765f" alt=""><figcaption></figcaption></figure></div>

...and then add the required `URL`:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F8Cw1ru6zn24GasE6p20X%2Fendpoint%20-%20url%203.png?alt=media&#x26;token=8e33b3ca-9912-4c40-9f78-a90887c737ad" alt=""><figcaption></figcaption></figure></div>

{% hint style="warning" %}
The maximum number of characters for an endpoint URL is 255. If you require a longer URL, consider defining elements as [parameters](#endpoint-parameters).
{% endhint %}

## Endpoint parameters

You can define two types of parameters:

* [Required](#required-parameters) parameters are added as key pairs and are always applied for the endpoint, whenever it is used. Use the top panel to add the required parameters.
* [Optional](#optional-parameters) parameters are displayed as [connection shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) filters, so users can apply their own values when using this endpoint as a data source in [process flows](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows). Use the lower panel to add optional parameters.

Any parameters you add (to either panel) here are **automatically** appended to the existing [endpoint URL](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/..#configuring-an-endpoint) as a query parameter when this endpoint is used in [process flows](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows).

### Required parameters

If you have parameters that must always be passed in the endpoint request URL, add them to the top panel. Any `required` (i.e. default) parameters are added as key pairs, and are passed straight into requests - users are never asked to provide values for these in [process flows](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows).

In the example below, our endpoint URL is set to `GET` all products, but we are adding a default URL parameter to add a query which will only retrieve products with a `product_type` of  `snowboard`:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fm2Z0O9z3Icz9V9kd9pQy%2Fendpoint%20-%20url%204.png?alt=media&#x26;token=6b483b47-27df-4758-892c-cc030367b38a" alt=""><figcaption></figcaption></figure></div>

By adding this as a `required` parameter for the endpoint, this query will be applied whenever this endpoint is added to [process flows](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows) (via a [connection shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape)). So, for our example, the actual endpoint used will be:

```
https://parseapi.back4app.com/classes/product?product_type=snowboard
```

{% hint style="info" %}
You can define static values for a default URL parameter or use a variable. For an example of where variables might be useful here, see [What if I want to force users to enter their required value for a URL parameter?](#what-if-i-want-to-force-users-to-enter-their-required-value-for-a-url-parameter)
{% endhint %}

### Optional parameters

`Optional` parameters are available for your users to update with their own required values, in process flows.&#x20;

If we consider the example above, we are always restricting our 'GET all products' endpoint to return only products with a `product_type` of  `snowboard`. But suppose we wanted to allow users to choose a `product_type` at the point they are running a process flow?

When a [process flow](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows) includes a [connection shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) which is configured to use this endpoint, users can see/update filter fields for any `optional` URL parameters defined for the endpoint. For example, let's add an optional parameter for `product_type`:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FLNlpx11giyVLa2A2sNPa%2Fendpoint%20-%20url%205.png?alt=media&#x26;token=969d2fb4-4828-4b2c-85a8-5d40576ee9d5" alt=""><figcaption></figcaption></figure></div>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FuKTXJEY34CVnak6PxrOz%2Fexample%20icon%202.svg?alt=media&#x26;token=7c8af2c5-9519-4757-bea9-172569a023bd" alt="" data-size="line"> What does the 'use as default' option do?</summary>

If you toggle the `use as default option` to `on`, this parameter will be displayed for users to see/update when they access a saved [connector shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) - for example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F0Xws8hQYkEC0BRFHhorg%2Fendpoint%20-%20url%206.png?alt=media\&token=cb495342-8433-4b53-9c83-023c7b2928b1)

If this option is `off`, users won't see the parameter in connector shapes unless they select the `add filter` button and select it - for example:\
\
![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F2y8zl8lTvlzsCtRchUit%2Fendpoint%20-%20url%207.png?alt=media\&token=bbaf096c-8ec4-4477-b0d7-42778eb52d0a)

</details>

Now, if we configure a [process flow connection shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) with this endpoint, a `product_type` filter option is available, so the person running this flow can choose to use it if they wish:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FHTZMEjmV5KeRQKFbHUlJ%2Furl%20param%20filter%20journey.png?alt=media&#x26;token=1c64b887-77ed-4bf3-8023-4f110e072e84" alt=""><figcaption></figcaption></figure>

When a process flow runs for this connector, associated API requests are injected with the user-provided URL parameter value wherever a `{{product_type}}` parameter is found.&#x20;

{% hint style="info" %}
These are optional parameters - users are not required to provide a value for the associated connection shape in process flows.&#x20;
{% endhint %}

## What if I want to force users to enter their required value for a URL parameter?

[Optional URL parameters](#optional-parameters) are just that - [process flow](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows) users can choose to add a parameter value if they wish. If a user doesn't choose to update an optional URL parameter field, then no query is applied.

However, there may be scenarios where you need to ensure that a URL parameter is always provided by users running a process flow. For this, a slightly different approach is needed - in this case, you would follow the steps below.

{% stepper %}
{% step %}
**Add a required endpoint variable**

Add a 'required' [endpoint variable](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/endpoint-options/endpoint-variables) for the field that you want to force users to update in process flows.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FBumEWCU6QNgxm5pQ3SUz%2Fadd%20endpoint%20variable.gif?alt=media\&token=c4ab57e1-d8f1-498e-a28d-4b65de995f4b)

</details>
{% endstep %}

{% step %}
**Update the endpoint URL**

Update the [endpoint URL](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/..#configuring-an-endpoint) to include a query for this variable.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FDHarQu5nOjXSUUYHYHkc%2Fadd%20query%20to%20url.gif?alt=media\&token=10d77f65-030f-484b-84c7-2dd3819bb34a)

</details>
{% endstep %}

{% step %}
**Add a default URL parameter**

Add a [default URL parameter](#default-parameters), specifying your endpoint variable (added in step 1) as the parameter value.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FDh6wTrzWkSnp229hedC1%2Fadd%20default%20url%20param.gif?alt=media\&token=9032cfc1-aae5-4c8f-8053-fafac2475e29)

</details>

Now, when a user adds this endpoint to a [connection shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) in a [process flow](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows), they must update this variable field before proceeding.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FQ1GhLPDTvvo3wtQd8PrF%2Fupdate%20variable%20in%20process%20flow.gif?alt=media\&token=1a8abcc8-ae1a-4e96-91d8-a26ed52c4828)

</details>
{% endstep %}
{% endstepper %}

## More information

Techniques for adding URL parameters are the same as all other types of parameters that you may encounter in the connector builder. For information, please see [Working with parameters](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/techniques-for-working-with-variables-and-parameters/working-with-parameters).
