# Trigger an External API

Follow the steps to trigger an External API within DBSync mapping:

1. Create a workflow and place them as the last sequence among all the workflows. As a result, the trigger is initiated after completion of all the workflow.
2. In Query Builder, select a datasource such as database and read only one record by limiting it to 1.\
   **Example:select \* from sku\_to\_qb\_relation limit 1.**
3. Under Rules, add Console adapter as Target Connector, Operation as insert and, Console as Target object.
4. Click map, and within out field, add a Java code to trigger External API. \
   **Example:**

{% code overflow="wrap" %}

```
{String location="
https://712c08e0.ngrok.io/appcenter/login
";try{jav
a.net
.HttpURLConnection c=(
java.net
.HttpURLConnection)new 
java.net
.URL(location).openConnection();c.setRequestMethod("GET");if(c.getResponseCode()==200){return new 
java.io
.BufferedReader(new 
java.io
.InputStreamReader(
c.ge
tInputStream())).lines().collect(java.util.stream.Collectors.joining());}}catch(
java.io
.IOException e){e.printStackTrace();}return "GET request did not work";}
```

{% endcode %}

5. Save and Close. Then, click Save Workflow.&#x20;
6. Click on 'Run Now' and check output within the Console.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydbsync.com/cloud-workflow/tutorials/database-and-quickbooks/trigger-an-external-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
