# @api

* 외부의 API를 요청할 때 사용해요.
* 앱을 만들 때 외부의 서비스 사용이 필요할 수 있어요.&#x20;
* 외부의 서비스가 API 방식을 제공할 때 해당 API를 로직에서 호출하여 사용할 수 있어요.

ex) 날씨 API 에서 제공하는 날씨 정보를 앱에 저장시킬 때, 축구 API 를 이용하여 경기의 결과를 정기적으로 수집하여 앱에서 보여줄 때 등.&#x20;

**사용 방법**

<figure><img src="/files/rkJTOpWO3SR8nNdd8HjQ" alt=""><figcaption></figcaption></figure>

1. 로직 설정 ➡︎ If When, Where에 원하는 값 입력  ➡︎ New data query 를 펼쳐 주세요. &#x20;
2. Event에서 @api를 드래그앤드롭하여 원하는 위치(flows, #ifTrue, #ifFalse, @for)에 넣어주세요.
3. 아래의 이미지와 같이 #url, #parameter, #type, #header, #setResponse에 필요한 값을 작성해 주세요.

<div align="left"><figure><img src="/files/jtzyYeZEWyYAXoyxpgUW" alt="" width="563"><figcaption></figcaption></figure></div>

**필드 설명**

* \#url (String, 동적 키, 동적 Object) => (최종형 String) (필수)
  * 호출할 API의 URL주소를 작성해요. &#x20;
* \#parameter (Object, 동적 키, 동적 Object) (최종형 Object) (선택)
  * url을 호출할 때 사용할 파라미터 설정할 수 있어요.&#x20;
  * 모든 데이터형이 사용할 수 있어요.
* \#type(String) (필수)
  * API의 타입을 설정해요.
  * 지금은 method가 post인 “documentParameterPost”만 지원하고 있어요.&#x20;
* \#header(Object, 동적 키, 동적 Object) => (최종형 Object) (선택)
  * API를 호출할 때 필요한 헤더의 설정 정보를 작성해요.&#x20;
* \#setResponse( (String, 동적 키, 동적 Object) => (최종형 String) (필수)
  * API를 요청하고 받은 값(response 값) 이 저장될 tmpDocument의 key를 작성해요.&#x20;

2024.03.11 Jinny


---

# 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.ohmyapp.io/main/guide/develop_app/command-execute-function/create-logic/conditions/detailed-processing-conditions/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.
