Agilis Advertising SDK อย่างเป็นทางการ
ไลบรารีสำหรับเจ็ดภาษา แต่ละไลบรารีครอบคลุมทุกเอนด์พอยต์ อ่านคีย์ของคุณจาก AGILIS_API_KEY ลองใหม่อย่างปลอดภัย แจ้งข้อผิดพลาดสำหรับรหัสส่งกลับทุกรหัส และตรวจสอบลายเซ็น Webhook
| ภาษา | แพ็กเกจ | การติดตั้ง | ข้อกำหนด | ซอร์สโค้ดและบันทึกการเปลี่ยนแปลง |
|---|---|---|---|---|
| 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 | ซอร์สโค้ด · บันทึกการเปลี่ยนแปลง |
คำขอแรกของคุณ
แสดงรายการหมวดหมู่ของ Offers ด้วยคีย์ Test ตัวอย่างแต่ละรายการมาจากแหล่งเดียวกับเอกสารอ้างอิง 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
ยืนยัน Webhook
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)
การแก้ไขปัญหา
- คีย์ไม่ได้รับการยอมรับ: โปรดตรวจสอบคีย์และโหมดของคีย์ คีย์ Test ใช้ได้เฉพาะในโหมด Test เท่านั้น
- ข้อผิดพลาดที่มาพร้อม HTTP 200: SDK จะแจ้งข้อผิดพลาดพร้อมรหัสส่งคืน (เช่น E3 ยอดเงินคงเหลือไม่เพียงพอ)
- คำขอมากเกินไป: SDK จะรอแล้วลองใหม่ โปรดส่งคำขอไม่เกิน 60 ครั้งต่อนาทีต่อคีย์
- ใช้งานผ่านพร็อกซีของบริษัท: บางเครือข่ายมีการตรวจสอบการเชื่อมต่อที่ปลอดภัย โปรดอนุญาต
ads.agilis.dating - รูปภาพถูกปฏิเสธ: รูปภาพจะได้รับการตรวจสอบก่อนเผยแพร่ โปรดเลือกรูปภาพอื่น
