admin管理员组

文章数量:1295902

I'm experiencing issues with the Snapchat Marketing API when trying to upload members to a newly created Custom Audience segment. The segment is created successfully, but subsequent attempts to upload members result in a 404 "Resource not found" error, even after waiting.

Flow:

  1. Create a new segment (successful)
  2. Wait for segment to be ready (5 minutes)
  3. Attempt to upload members (fails with 404)

Create Segment Response (successful):

json
{
"request_status": "SUCCESS",
"segments": [{
"sub_request_status": "SUCCESS",
"segment": {
"id": "1234690325678104",
"name": "Test Audience 7",
"status": "ACTIVE",
"targetable_status": "NOT_READY",
"upload_status": "NO_UPLOAD"
}
}]
}

Upload Members Error Response:

`json
{
"request_status": "ERROR",
"request_id": "fac77e07-a307-503e-a641-6b95234a5e59",
"debug_message": "Resource can not be found",
"display_message": "Resource can not be found",
"error_code": "E3003"
}`

code:

java
// Create segment
Map<String, Object> segment = new HashMap<>();
segment.put("name", name);
segment.put("description", "Created via platform");
segment.put("source_type", "FIRST_PARTY");
segment.put("retention_in_days", 180);
segment.put("ad_account_id", adAccountId);
// Wait for segment to be ready
Thread.sleep(300000); // 5 minute delay
// Upload members
String endpoint = baseUrl + "/adaccounts/" + adAccountId + "/segments/" + segmentId + "/upload";
Map<String, Object> requestBody = new HashMap<>();
requestBody.put("audience", audienceMembers); // List of hashed emails
requestBody.put("segment_id", segmentId);
HttpEntity<Map<String, Object>> request = new HttpEntity<>(requestBody, headers);
ResponseEntity<Map> response = restTemplate.exchange(
endpoint,
HttpMethod.POST,
request,
Map.class
);`
  1. Added a 5-minute delay after segment creation
  2. Implemented retry logic (3 attempts with 30-second intervals)
  3. Verified the segment exists and checked its status before upload
  4. Confirmed all emails are properly SHA-256 hashed
  5. Verified authentication token is valid

本文标签: