공식 Agilis Advertising SDK
7개 언어용 라이브러리입니다. 각 SDK는 모든 엔드포인트를 지원하고, AGILIS_API_KEY에서 키를 읽으며, 안전하게 재시도하고, 모든 반환 코드에 대해 오류를 발생시키며, 웹훅 서명을 검증합니다.
| 언어 | 패키지 | 설치 | 필요 버전 | 소스 및 변경 내역 |
|---|---|---|---|---|
| Node.js and TypeScript | @agilisdating/ads (npm) |
npm install @agilisdating/ads |
Node.js 20 or later | 소스 · 변경 내역 |
| Python | agilis-ads (PyPI) |
pip install agilis-ads |
Python 3.10 or later | 소스 · 변경 내역 |
| PHP | agilisdating/agilis-ads (Packagist) |
composer require agilisdating/agilis-ads guzzlehttp/guzzle |
PHP 8.2 or later, with any PSR-18 HTTP client (Guzzle suggested) | 소스 · 변경 내역 |
| .NET (C#) | Agilis.Ads (NuGet) |
dotnet add package Agilis.Ads |
.NET 8 or later, or .NET Standard 2.0; usable from Visual Basic too | 소스 · 변경 내역 |
| Java | dating.agilis:agilis-ads (Maven Central) |
implementation("dating.agilis:agilis-ads:0.1.0") Gradle (Kotlin). With Maven: groupId dating.agilis, artifactId agilis-ads, version 0.1.0. |
Java 17 or later | 소스 · 변경 내역 |
| Go | github.com/agilisdating/agilis-ads-go (pkg.go.dev) |
go get github.com/agilisdating/agilis-ads-go |
Go 1.22 or later | 소스 · 변경 내역 |
| Ruby | agilis-ads (RubyGems) |
gem install agilis-ads |
Ruby 3.2 or later | 소스 · 변경 내역 |
첫 번째 요청
테스트 키로 혜택 카테고리 목록을 조회해 보세요. 모든 예제는 API 레퍼런스와 같은 소스에서 가져온 것입니다.
Node.js and TypeScript
import { Agilis } from '@agilisdating/ads';
const client = new Agilis(); // reads AGILIS_API_KEY
const result = await client.categories.list();
console.log(result.categories?.length);Python
from agilis_ads import Agilis client = Agilis() # reads AGILIS_API_KEY result = client.categories.list() print(len(result["categories"]))
PHP
<?php require 'vendor/autoload.php'; use Agilis\Ads\AgilisClient; $agilis = new AgilisClient(); // reads AGILIS_API_KEY $result = $agilis->categories->list(); echo count($result['categories']), "\n";
.NET (C#)
using Agilis.Ads; using var client = new AgilisClient(); // reads AGILIS_API_KEY var result = await client.Categories.ListAsync(); Console.WriteLine(result.Categories.Count);
Java
import dating.agilis.ads.AgilisClient; AgilisClient client = AgilisClient.builder().build(); // reads AGILIS_API_KEY var result = client.categories().list(); System.out.println(result.getCategories().size());
Go
package main
import (
"context"
"fmt"
"log"
agilisads "github.com/agilisdating/agilis-ads-go"
)
func main() {
client := agilisads.NewClient("") // reads AGILIS_API_KEY
ctx := context.Background()
result, err := client.Categories.List(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Println(len(result.Categories))
}Ruby
require "agilis_ads" client = AgilisAds::Client.new # reads AGILIS_API_KEY result = client.categories.list puts result.categories.length
웹훅 검증
각 SDK는 한 번의 호출로 Agilis-Signature 헤더를 엔드포인트의 시크릿과 대조해 확인합니다. 파싱하기 전의 원본 요청 본문을 사용하세요.
Node.js and TypeScript
import { webhooks } from '@agilisdating/ads';
const event = webhooks.constructEvent(rawBody, signatureHeader, secret);Python
from agilis_ads import construct_event event = construct_event(raw_body, signature_header, secret)
PHP
use Agilis\Ads\Webhooks; $event = (new Webhooks())->constructEvent($rawBody, $signatureHeader, $secret);
.NET (C#)
using Agilis.Ads; var webhookEvent = Webhooks.ConstructEvent(rawBody, signatureHeader, secret);
Java
import dating.agilis.ads.Webhooks; var event = Webhooks.constructEvent(rawBody, signatureHeader, secret);
Go
import agilisads "github.com/agilisdating/agilis-ads-go" event, err := agilisads.ConstructEvent(payload, signatureHeader, secret)
Ruby
require "agilis_ads" event = AgilisAds::Webhook.construct_event(raw_body, signature_header, secret)
문제 해결
- 키가 거부된 경우: 키와 키의 모드를 확인하세요. 테스트 키는 테스트 모드에서만 작동합니다.
- HTTP 200과 함께 오류가 반환된 경우: SDK가 반환 코드와 함께 오류를 발생시킵니다(예: E3, 잔액 부족).
- 요청이 너무 많은 경우: SDK가 대기한 후 다시 시도합니다. 키당 분당 60회 미만으로 요청하세요.
- 회사 프록시를 사용하는 경우: 일부 네트워크는 보안 연결을 검사합니다.
ads.agilis.dating을(를) 허용하세요. - 이미지가 거부된 경우: 이미지는 게시 전에 검토됩니다. 다른 이미지를 선택하세요.
