I try to add users by APPUID to custom audience. I do post to the url https://graph.facebook.com/v2.10/CUSTOM_AUDIENCE_ID/users with this payload:
{
"schema": ["APPUID"],
"app_ids": ["<APP_ID>"],
"data": [["<ID1>"], ["<ID2>"], ...]
}
Data contains 5000 APPUIDs. The response is:
{
"invalid_entry_samples": {},
"audience_id": "<AUDIENCE_ID>",
"num_invalid_entries": 0,
"session_id": "<SESSION_ID>",
"num_received": 5000
}
But after that the delivery status for this custom audience is: "Audiences must include at least 20 people to be used for ads.".
What am I doing wrong? And why is the size of the custom audience smaller than 20?
Related
I'm using google directory search API but i coudn't retrive the users names(firstName, lastName) details in response even after applying proper readMask
below is the request details:
{
"method": "GET",
"headers": {
"Authorization": "Bearer access_token",
"Content-Type": "application/json"
},
"uri": "https://people.googleapis.com/v1/people:searchDirectoryPeople?query=ajay&readMask=names,nicknames,addresses,calendarUrls,emailAddresses,organizations,phoneNumbers,photos,relations&sources=DIRECTORY_SOURCE_TYPE_DOMAIN_CONTACT&sources=DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE"
}
NOTE: I'm getting the proper results with api, but issue is for some contact results, i'm not getting names(firstname, lastname) data/info in the response
If you are getting a "PERMISSION_DENIED" error, this means the access token you are using doesn't have the directory access scope:
https://www.googleapis.com/auth/directory.readonly
Which is required for accessing directory contacts.
Also your sources param should be:
sources=DIRECTORY_SOURCE_TYPE_DOMAIN_CONTACT,DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE
and not
sources=DIRECTORY_SOURCE_TYPE_DOMAIN_CONTACT&sources=DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE
P.S.
It's a very bad idea to post real access-tokens in public posts, you should always redact secrets when you post your API requests online.
I'm trying to reach SAP Business One Service Layer APU via PostMan and Python (with requests module). However, when I try to POST to /Login endpoint to our Service Layer it gives me the following JSON result:
{ "error": { "code": -304, "message": { "lang": "en-us", "value": "" } } }
As you can see, it's an error code -304 with an empty message value.
The payload I'm sending is a text like this:
{"UserName":"my_username","Password":"my_password","CompanyDB":"NAME_OF_MY_DB"}
I have tried this payload as well to /Login enpoint but with no successful result:
{"Username":"my_username","Password":"my_password","CompanyDB":"NAME_OF_MY_DB"}
but this results in this JSON result:
{ "error": { "code": 102, "message": { "lang": "en-us", "value": "Invalid login credential." } } }
Can anyone, please, suggest what may be wrong here? I need to Login and then GET the Items from the DB.
Thank you in advance
The issue was that I needed to use a domain before the username. So, at the end, the working payload looks like this:
{"UserName":"my_domain\\my_username","Password":"my_password","CompanyDB":"NAME_OF_MY_DB"}
I put this code in my body
{
"contact": {
"project_id": 1,
"first_name": "John",
"address_attributes": {"street1": "12, Street", "city": "Moscow", "country_code": "RU"},
"tag_list": "vip,cold call"
}
}
I tried to put an API key in param and header also respectively but every time it gives me "403:forbidden" error
Any help will be grateful.
Hi Maulik and welcome to StackOverflow.
You would need to check the api documentation to know how the api keys are to be passed in.
In many cases(not sure if most), this is done by passing it in as an header usually the Authorization headers.
Most apis that use this technique require you to add it by adding the header key as Authorization and its value as 'Bearer {API_KEY}' where {API_KEY} represents the api-key you aim to send.
Have a nice day
I am trying to use Instagram Business Discovery API to get post statistics from a certain public page.
Take Bath and Body Works (https://www.instagram.com/bathandbodyworks) for example.
GET graph.facebook.com
17895695668004550?fields=business_discovery.username(bathandbodyworks){followers_count,media_count,media{timestamp,like_count,comments_count}}
This will give me the following response:
{
"business_discovery": {
"followers_count": 3526159,
"media_count": 3536,
"media": {
"data": [
{
"timestamp": "2018-05-16T20:00:54+0000",
"like_count": 28925,
"comments_count": 530,
"id": "17917935010179826"
},
(24 posts data omitted...)
"paging": {
"cursors": {
"after": "QVFIUlBNak5fNTc3eThl..." (a very long string)
}
}
}
Now, this only gives me the most recent 25 posts, which I believe is the limit per request set by Facebook.
What should I do if I want to load the next 25 posts?
In YouTube Data API there is also a limit per request of 50, but a "nextPageToken" is provided to load the next 50 post. I assume this is the same case here?
I also found in this Facebook API document that maybe I can add a cursor string like: &after=QVFIUlBNak5fNTc3eThl...,
but this doesn't work.
Any suggestions would be appreciated, thank you!
The pagination with business_discovery is a bit different from Facebook
pagination.
There's no next and previous url's.
You need to add, after cursor as this example:
https://graph.facebook.com/v2.12/xxxx?fields=business_discovery.username(jacqehoward){id,name,username,website,profile_picture_url,biography,followers_count,media_count,media.after(QVFIUlZA5aTR5NTE4Y24tNW90VGZAPTVBtb0NpOEFPTlNLeklmVTEtUDZAfVnE0YnBhUVNOQ3BDaktzNHJBTENhTmVYLUV2SGJPZAVAxZA09hQ2NhUGdnUGFjMTNn){id,caption,comments_count,like_count,media_type,media_url,owner,timestamp}}
Note:
media.after(after_cursor){media_fields}
And if you want to paginate through business_discovery to the end you must add after cursors until there's only response with previous cursor. This is the mark that you reached the first post.
In this topic https://developers.facebook.com/docs/marketing-api/audiences-api in part "Custom Audiences from CRM Data" mentioned that I can use Page Scoped User IDs to create custom audience.
What schema type I must specify to use PSIDs? Is it possible now from API?
It looks like you can use this format when you post the the /user endpoint of a custom audience:
{
payload: {
schema: ["PAGEUID"],
is_raw: true,
page_ids: ["323209841097806"],
data: [
["10208379178770401"],
["10208379178770402"],
["10208379178770403"],
["10208379178770404"],
["10208379178770405"]
]
}
}