Offizielle Agilis Advertising SDKs
Bibliotheken für sieben Sprachen. Jede deckt alle Endpunkte ab, liest Ihren Schlüssel aus AGILIS_API_KEY, wiederholt Anfragen sicher, löst bei jedem Rückgabecode einen Fehler aus und verifiziert Webhook-Signaturen.
| Sprache | Paket | Installation | Voraussetzung | Quellcode und Änderungsprotokoll |
|---|---|---|---|---|
| Node.js and TypeScript | @agilisdating/ads (npm) |
npm install @agilisdating/ads |
Node.js 20 or later | Quellcode · Änderungsprotokoll |
| Python | agilis-ads (PyPI) |
pip install agilis-ads |
Python 3.10 or later | Quellcode · Änderungsprotokoll |
| 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) | Quellcode · Änderungsprotokoll |
| .NET (C#) | Agilis.Ads (NuGet) |
dotnet add package Agilis.Ads |
.NET 8 or later, or .NET Standard 2.0; usable from Visual Basic too | Quellcode · Änderungsprotokoll |
| 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 | Quellcode · Änderungsprotokoll |
| Go | github.com/agilisdating/agilis-ads-go (pkg.go.dev) |
go get github.com/agilisdating/agilis-ads-go |
Go 1.22 or later | Quellcode · Änderungsprotokoll |
| Ruby | agilis-ads (RubyGems) |
gem install agilis-ads |
Ruby 3.2 or later | Quellcode · Änderungsprotokoll |
Ihre erste Anfrage
Listen Sie die Offer-Kategorien mit einem Test-Schlüssel auf. Jedes Beispiel stammt aus derselben Quelle wie die API-Referenz.
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 verifizieren
Jedes SDK prüft den Header Agilis-Signature mit einem einzigen Aufruf anhand des Secrets Ihres Endpunkts. Verwenden Sie den unveränderten Request-Body, bevor er geparst wird.
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)
Fehlerbehebung
- Schlüssel nicht akzeptiert: Prüfen Sie den Schlüssel und seinen Modus; Test-Schlüssel funktionieren nur im Modus Test.
- Ein Fehler mit HTTP 200: Das SDK löst ihn mit seinem Rückgabecode aus (zum Beispiel E3, nicht genügend Guthaben).
- Zu viele Anfragen: Das SDK wartet und versucht es erneut; bleiben Sie unter 60 Anfragen pro Minute und Schlüssel.
- Hinter einem Firmen-Proxy: Manche Netzwerke prüfen sichere Verbindungen; geben Sie
ads.agilis.datingfrei. - Ein Bild wurde abgelehnt: Bilder werden vor der Veröffentlichung geprüft; wählen Sie ein anderes Bild.
