배너 광고
curl --request GET \
--url https://api-v2.adrop.io/request \
--header 'Authorization: <authorization>'import requests
url = "https://api-v2.adrop.io/request"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api-v2.adrop.io/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-v2.adrop.io/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-v2.adrop.io/request"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-v2.adrop.io/request")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.adrop.io/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "OK",
"result": {
"id": "ad_123456",
"format": "banner",
"type": "display",
"unit": "YOUR_UNIT_ID",
"w": 320,
"h": 100,
"ad": "<div>...</div>",
"target": "external",
"carouselActivated": false
}
}
REST API
배너 광고
REST API를 사용하여 배너 광고를 요청하는 방법을 안내합니다.
GET
/
request
배너 광고
curl --request GET \
--url https://api-v2.adrop.io/request \
--header 'Authorization: <authorization>'import requests
url = "https://api-v2.adrop.io/request"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api-v2.adrop.io/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-v2.adrop.io/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-v2.adrop.io/request"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api-v2.adrop.io/request")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.adrop.io/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "OK",
"result": {
"id": "ad_123456",
"format": "banner",
"type": "display",
"unit": "YOUR_UNIT_ID",
"w": 320,
"h": 100,
"ad": "<div>...</div>",
"target": "external",
"carouselActivated": false
}
}
배너 광고는 HTML 형식으로 반환되므로 웹 프로젝트에서 직접 렌더링할 수 있습니다. 다른 플랫폼에서는 WebView를 사용하여 렌더링할 수 있습니다.
요청 파라미터
헤더
App Key (adrop_service.json에서 확인)
쿼리 파라미터
광고 유닛 ID
사용자 고유 식별자. 광고 노출 빈도 제어와 타겟팅에 사용됩니다.
플랫폼.
android, ios, web 중 하나로케일. 예:
ko_KR, en_US테마 모드.
light 또는 dark문맥 타겟팅 ID (타겟팅 광고 요청 시 필수)
광고 식별자 (내 기기에서 보기 시 필수)
응답
응답 코드.
0은 성공을 의미합니다.응답 메시지
{
"code": 0,
"msg": "OK",
"result": {
"id": "ad_123456",
"format": "banner",
"type": "display",
"unit": "YOUR_UNIT_ID",
"w": 320,
"h": 100,
"ad": "<div>...</div>",
"target": "external",
"carouselActivated": false
}
}
렌더링
웹에서 렌더링
<div id="ad-container"></div>
<script>
fetch('https://api-v2.adrop.io/request?unit=YOUR_UNIT_ID&uid=USER_ID&pf=web', {
headers: { 'Authorization': 'YOUR_APP_KEY' }
})
.then(res => res.json())
.then(data => {
if (data.code === 0) {
document.getElementById('ad-container').innerHTML = data.result.ad;
}
});
</script>
캐러셀 배너
캐러셀 배너를 사용하는 경우 아래 스크립트를 추가해야 합니다:<script src="https://storage.adrop.io/js/adrop-carousel-1.0.1.min.js"></script>
관련 문서
네이티브 광고
커스텀 UI로 광고 구현
에러 코드
에러 처리 방법
이 페이지가 도움이 되었나요?
⌘I