curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890', headers=headers)
print(r.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");
var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", nil)
req.Header.Add("Authorization", "Bearer API_KEY")
resp, _ := client.Do(req)
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class GetDsaRecommendations {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890"))
.header("Authorization", "Bearer API_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
require 'net/http'
require 'json'
uri = URI('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer API_KEY'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(req)
}
puts res.body
{
"status": "success",
"dsaRecommendations": [
"Beneficiary 1",
"Beneficiary 2",
"Beneficiary 3"
],
"count": 1
}
{
"action": "ads",
"status": "error",
"code": 413,
"message": "There was an error getting the DSA recommendations. Please try again."
}
Facebook Ads
DSA-рекомендації
Отримайте рекомендації DSA для Facebook
GET
/
ads
/
facebook
/
dsaRecommendations
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890', headers=headers)
print(r.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");
var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", nil)
req.Header.Add("Authorization", "Bearer API_KEY")
resp, _ := client.Do(req)
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class GetDsaRecommendations {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890"))
.header("Authorization", "Bearer API_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
require 'net/http'
require 'json'
uri = URI('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer API_KEY'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(req)
}
puts res.body
{
"status": "success",
"dsaRecommendations": [
"Beneficiary 1",
"Beneficiary 2",
"Beneficiary 3"
],
"count": 1
}
{
"action": "ads",
"status": "error",
"code": 413,
"message": "There was an error getting the DSA recommendations. Please try again."
}
Отримайте рекомендації Digital Services Act (DSA) для вашого рекламного акаунта Facebook.
Відповідно до вимог, установлених Digital Services Act (DSA) Європейського Союзу (ЄС), Facebook вимагає, щоб реклама, орієнтована на будь-яку частину ЄС, надавала строкові значення, що визначають бенефіціара та платника створюваної реклами.
Цей ендпоінт надає перелік рекомендованих бенефіціарів і платників DSA, які можна використати під час просування дописів.
Ці поля можна використати в
dsaBeneficiary та dsaPayor.
- Виводить перелік рядків (максимум 25), які Facebook визначив як імовірних бенефіціарів/платників, ґрунтуючись на нещодавній активності рекламного акаунта.
- Ці рекомендації можна використовувати як значення параметрів
dsaBeneficiaryіdsaPayorв ендпоінті Boost Post. - Якщо під час просування дописів надається один із параметрів
dsaBeneficiaryчиdsaPayor, обидва повинні бути задані разом.
Параметри заголовка
Query-параметри
ID рекламного акаунта Facebook, для якого потрібно отримати DSA-рекомендації. ID акаунта можна отримати
з ендпоінта рекламних акаунтів.
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890', headers=headers)
print(r.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer API_KEY"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");
var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", nil)
req.Header.Add("Authorization", "Bearer API_KEY")
resp, _ := client.Do(req)
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class GetDsaRecommendations {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890"))
.header("Authorization", "Bearer API_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
require 'net/http'
require 'json'
uri = URI('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer API_KEY'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
http.request(req)
}
puts res.body
{
"status": "success",
"dsaRecommendations": [
"Beneficiary 1",
"Beneficiary 2",
"Beneficiary 3"
],
"count": 1
}
{
"action": "ads",
"status": "error",
"code": 413,
"message": "There was an error getting the DSA recommendations. Please try again."
}
⌘I
