# URL

## Introduction

The endpoint **URL** page is used to define the HTTP method and URL to be used, and any required 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%2FFOeRsVqHXx2NHBToknmY%2Fendpoint%20-%20url%201.png?alt=media&#x26;token=adaf9ab1-8db1-4231-9ef2-88360f70e370" 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%2FoP3ZUq6IE0cSJGCVQqYf%2Fendpoint%20-%20url%202.png?alt=media&#x26;token=49ce3d2d-ae8a-4404-8769-bbafa933f4ab" 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%2FAiCmIgWbi7yvtYo3AWYL%2Fendpoint%20-%20url%203.png?alt=media&#x26;token=15ad8ff8-6dde-4ec3-8f97-b0dd1032ff04" alt=""><figcaption></figcaption></figure></div>

## Endpoint parameters

You can define two types of parameter:

* [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 required parameters.
* [Optional](#optional-parameters) parameters are displayed as [connection shape](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) filters, so users can apply with their own values when using this endpoint as a data source in [process flows](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/process-flows/about-process-flows). Use the lower panel to add optional parameters.

Any parameters that you add (to either panel) here are **automatically** appended to the existing [endpoint URL](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/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/~/changes/J8IbZkP6ASUZu2oBhGi2/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. 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/~/changes/J8IbZkP6ASUZu2oBhGi2/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 **default URL parameter** for the endpoint, this query will be applied whenever this endpoint is added to [process flows](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/process-flows/about-process-flows) (via a [connection shape](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape)). The actual endpoint used will be:

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

{% 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/~/changes/J8IbZkP6ASUZu2oBhGi2/process-flows/about-process-flows) includes a [connection shape](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/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** that have been 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 ON the `use as default option`, this parameter will be displayed for users to see/update when they first access the saved connection 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 it unless they select the add new filter button and add it manually - 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/~/changes/J8IbZkP6ASUZu2oBhGi2/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/~/changes/J8IbZkP6ASUZu2oBhGi2/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:

**Step 1**\
Add a 'required' [endpoint variable](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/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>

**Step 2**\
Update the [endpoint URL](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/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>

**Step 3**\
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>

**Step 4**\
Now when a user adds this endpoint to a [connection shape](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape) in a [process flow](https://doc.wearepatchworks.com/product-documentation/~/changes/J8IbZkP6ASUZu2oBhGi2/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>

## More information

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