curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"], ["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
schema: ["EMAIL"],
data: [
["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"],
["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'schema': ['EMAIL'],
'data': [
['5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7'],
['a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01']
]
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"received": 2,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "schema takes one key per request on snapchat: send EMAIL, PHONE and MADID in separate requests."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 8c1e2f3a-0000-4000-8000-000000000102 is a lookalike audience; members can be added to or removed from a customerList audience only."
}
Snapchat Ads
Thành viên đối tượng
Thêm hoặc xóa người khỏi phân khúc danh sách khách hàng Snapchat bằng cách gửi hàm băm SHA-256 của email, số điện thoại hoặc ID quảng cáo di động của họ.
POST
/
ads
/
snapchat
/
audiences
/
{id}
/
users
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"], ["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
schema: ["EMAIL"],
data: [
["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"],
["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'schema': ['EMAIL'],
'data': [
['5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7'],
['a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01']
]
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"received": 2,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "schema takes one key per request on snapchat: send EMAIL, PHONE and MADID in separate requests."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 8c1e2f3a-0000-4000-8000-000000000102 is a lookalike audience; members can be added to or removed from a customerList audience only."
}
Thêm người vào một phân khúc danh sách khách hàng được tạo bằng Tạo đối tượng (
type: customerList), hoặc xóa họ. Bạn gửi mỗi người dưới dạng hàm băm SHA-256 của một định danh đã chuẩn hóa; Snapchat khớp các hàm băm với tài khoản; giá trị gốc không bao giờ rời khỏi hệ thống của bạn.
DELETE /ads/snapchat/audiences/{id}/users nhận cùng body và thay vào đó sẽ xóa những người này.
- Mỗi yêu cầu một loại định danh: gửi email, số điện thoại và ID quảng cáo di động trong các yêu cầu riêng.
- Mỗi yêu cầu chứa tối đa 10.000 hàng và body tối đa 10 MiB. Gửi danh sách lớn hơn thành nhiều yêu cầu.
- Phân khúc có thể dùng trong một lượt boost khi Snapchat đã khớp đủ người. Đối tượng hiển thị
status.readykhi điều đó xảy ra. - Id phải là phân khúc danh sách khách hàng trên tài khoản quảng cáo được nêu trong
accountId. Mọi id khác, kể cả id đã xóa hoặc không xác định, sẽ trả về400vớicode: 101, và không có gì được gửi.
Định danh đã băm là dữ liệu cá nhân
Email hoặc số điện thoại đã băm vẫn là dữ liệu cá nhân theo GDPR và các luật tương tự. Khi bạn tải lên một danh sách:- Bạn là bên kiểm soát dữ liệu. Bạn cần một cơ sở pháp lý, thường là sự đồng ý của những người trong danh sách, để dùng dữ liệu của họ cho quảng cáo, theo yêu cầu của chính sách quyền riêng tư của bạn và điều khoản quảng cáo của Snapchat.
- Ayrshare là bên xử lý. Chúng tôi chuyển các hàm băm cho Snapchat và không giữ lại gì ngoài số đếm: không hàng nào của body được ghi log, lưu cache hay lưu trữ, và phản hồi không bao giờ lặp lại một hàng.
- Bạn băm trước khi gửi. Ayrshare không bao giờ băm giúp bạn. Một giá trị không phải hàm băm sẽ bị từ chối trước khi bất cứ thứ gì được gửi đến Snapchat.
Cách băm
Chuẩn hóa từng giá trị theo mô tả trong quy tắc danh sách khách hàng của Snapchat, sau đó băm bằng SHA-256 và gửi kết quả dưới dạng 64 ký tự hex chữ thường. Tóm lại:EMAIL: bỏ khoảng trắng và chuyển thành chữ thường, ví dụjane@example.com.PHONE: chỉ chữ số, có mã quốc gia, không có00ở đầu hay số0đầu theo định dạng trong nước, ví dụ14155551234hoặc448444124653.MADID: ID quảng cáo di động (IDFA hoặc ID quảng cáo Android) viết thường, giữ nguyên dấu gạch nối.
Tham số Header
Tham số đường dẫn
Id phân khúc danh sách khách hàng, lấy từ Tạo đối tượng hoặc Đối tượng.
Tham số Body
Định danh duy nhất mà các hàng chứa:
["EMAIL"], ["PHONE"] hoặc ["MADID"]. Đây là các tên giống với Facebook và Instagram.Mỗi người một hàng: một mảng chứa hàm băm SHA-256 của người đó, dưới dạng 64 ký tự hex chữ thường. Tối đa 10.000 hàng.Một ô không phải hàm băm như vậy, một hàng sai độ rộng, một khóa không được hỗ trợ hoặc nhiều hơn một khóa sẽ trả về
400 với code: 101 trước khi bất cứ thứ gì được gửi đến Snapchat. Thông báo nêu hàng và cột, không bao giờ nêu giá trị, ví dụ data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters.Phản hồi
Chỉ có số đếm:received: số hàng Snapchat đã nhận.invalid: số hàng Snapchat không nhận.batches: số lượt tải lên đã dùng để gửi các hàng.
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"], ["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
schema: ["EMAIL"],
data: [
["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"],
["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'schema': ['EMAIL'],
'data': [
['5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7'],
['a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01']
]
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"received": 2,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "schema takes one key per request on snapchat: send EMAIL, PHONE and MADID in separate requests."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 8c1e2f3a-0000-4000-8000-000000000102 is a lookalike audience; members can be added to or removed from a customerList audience only."
}