# External Request

With external requests, you can call APIs from other third parties or your own server to request data, submit data and etc.

<div align="left"><figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2F2vOukgbaPRqTe1JIyhiy%2Fexternal-request1.7c27838f.png?alt=media&#x26;token=e184c580-6f1e-4802-9950-bd901f5db51f" alt=""><figcaption></figcaption></figure></div>

In an Action step, find "External Request" in "Advance Actions" and click "Add your request" then start editing it:

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2F52LLWoqJN5pj73jfMluO%2Fexternal-request2.cddb7524.png?alt=media&#x26;token=eaada289-ea19-4d66-90a1-f7378746842b" alt=""><figcaption></figcaption></figure>

1. choose a request type such as GET, POST, etc
2. paste your request URL / endpoint
3. adjust "URL parameters", "Headers", "Body" or "Authorization" section if needed. e.g. setup API key
4. click "Test" and area 5 will show in the "Response" section with a response code
5. click on "Response Headers" to expand the header for more details and the received data is in blue
6. choose which part of the data you need by clicking the circle on the left-side accordingly
7. after clicking area 6, the JSON path for the selected data is automatically shown here. $ means the whole JSON.
8. choose which custom field to store the data. You can create a new field here by typing in a field name and clicking it in the drop-down. Click the "Add" button to add to the mapping list
9. finally, the mapping shows in area 9. Add as many mapping as needed and click "Save".

{% hint style="info" %}
Make sure you provide testing data for any one of the fields/variables in the settings before you use the **Test** button.
{% endhint %}

### URL Params <a href="#url-params" id="url-params"></a>

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2FBOkTBGkeg2HMq0WHUH1x%2Fexternal-request3.b9dc4b09.png?alt=media&#x26;token=5bcd7f96-38b5-46f2-9e39-62b207bd80ab" alt=""><figcaption></figcaption></figure>

In the above screenshot, we can see that there is a URL parameter in the endpoint called "user\_name". Remember to copy the endpoint down and provide a testing value.

Alternatively, you can use the **URL Params** sections for the same result.

### Headers

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2FXA8wHiWCdeSzc1BYoSll%2Fdownload%20(66).png?alt=media&#x26;token=f9d76ee7-a431-4722-875a-596efab41421" alt=""><figcaption></figcaption></figure>

Same as **URL Params**, put your key name first, then insert the variable and provide a testing value.

### Authorization

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2Fp13EeXhVhsJ17pZDlQ0R%2Fexternal-request5.41686223.png?alt=media&#x26;token=544687cf-c600-4896-ab91-81d91503ac15" alt=""><figcaption></figcaption></figure>

Alternatively, put the token in the **Authorization** section. It's going to be less error-prone (sometimes people just forgot the "Bear " in front of the token).

Moreover, for **Basic Auth**, simply put your username and password value and the system will do the base64 encoding for you.

### Body <a href="#body" id="body"></a>

To include a file itself in the parameters, use **multipart/form-data**:

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2FMayixVSvMPyLXWBvDtXy%2Fexternal-request6.48902713.png?alt=media&#x26;token=3ea755b1-5e03-4d4f-b778-09deec1fc94a" alt=""><figcaption></figcaption></figure>

**x-www-for-urlencoded** works just like **URL Params** or **Headers** section.

Instead of listing all the payloads in **x-www-form-urlencoded**, you can also paste the example payload in raw JSON:

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2Fz7NlCbzkw623J8N9eiz7%2Fexternal-request7.a95b57ba.png?alt=media&#x26;token=bfc1c2cf-0b81-40c5-bb92-a7b326336bd6" alt=""><figcaption></figcaption></figure>

On the left-hand side, **Body Content**, paste or write your JSON first, when you insert a variable, the **Test body content** shows on the right side immediately. It's to specify a testing JSON value.

Click on **Copy from body content** to copy the whole JSON structure. All the variables will be replaced by {{`variable_name`}}. Remove the placeholder and put your testing values.

### Testing <a href="#testing" id="testing"></a>

Once you are ready, click on the **Test** button next to the URL endpoint or in the **Response** section.

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2FDwdmaMhqAyYrTy8ng08y%2Fexternal-request8.d05241c5.png?alt=media&#x26;token=df4100dd-2686-4b64-80d7-67c5758cd8c3" alt=""><figcaption></figcaption></figure>

Besides the tips about how to map data above, you might also want to save the values in the response header for later use. Simply expand the header, click on a value in the header and the JSON path to it shows automatically there.
