I'm getting an odd error from the Facebook ADs API. Sending the following payload:
{
"campaign_group_id": "54321",
"bid_type": "ABSOLUTE_OCPM",
"name": "Hello AdCampaign",
"bid_info": {
"ACTIONS": 1
},
"targeting": {
"behaviors": [
{
"name": "BEHAVIOR NAME",
"id": 12345
}
],
"geo_locations": {
"countries": [
"US"
]
},
"page_types": "feed"
},
"campaign_status": "ACTIVE",
"daily_budget": 100
}
Providing this payload to the ads api is returning the following error message:
You are requesting a transaction which requires the adgroups to be normalized, but normalize failed because Normalization expects a collection
Which has an associated error code of 1487079 which.. I cannot find documentation for.. ANYWHERE.
This will work, if I remove the behaviors attribute of targeting.. but of course that isn't desirable. So it's something to do with the behaviors.
As per the docs, I believe page_types should be a list. Try this:
{
...
"page_types": ["feed"],
...
}
Related
I am working with FB Graph API to get the names of the users who like or react to my post. By using
get/version/{post-id}/likes
I have been able to get the names and IDs of all likers. Now I also want to get other reactions i.e. HAHA or Love reactions, but when I use get/version/{post-id}/reactions I get this error
{
"error": {
"message": "(#100) Tried accessing nonexisting field (reactions) on node type (Photo)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Abwl9IBIxglskXT3yivpWUm"
}
}
Is it possible to get all reactions or not?
The users will authorize the app so that's not a problem.
So basically after 3 days of wait, I got no answer. So I decided to post an answer myself. What I found in these 3 days is that it is not possible to get all the reactions. Likes and Care are the only data you will get.
If I ever found a way to get it all, I will update the answer.
It is possible to get all the reactions on a post (including Photos) by requesting this endpoint:
{user_id}_{post_id}?fields=
reactions.type(LOVE).limit(0).summary(total_count).as(love),
reactions.type(WOW).limit(0).summary(total_count).as(wow),
reactions.type(HAHA).limit(0).summary(total_count).as(haha),
reactions.type(LIKE).limit(0).summary(total_count).as(like),
reactions.type(ANGRY).limit(0).summary(total_count).as(angry),
reactions.type(SAD).limit(0).summary(total_count).as(sad)
(Remove all newlines, I put them in only to make the URL more readable).
This returns
{
"love": {
"data": [
],
"summary": {
"total_count": 50
}
},
"wow": {
"data": [
],
"summary": {
"total_count": 20
}
},
"haha": {
"data": [
],
"summary": {
"total_count": 24
}
},
"like": {
"data": [
],
"summary": {
"total_count": 60
}
},
"angry": {
"data": [
],
"summary": {
"total_count": 1
}
},
"sad": {
"data": [
],
"summary": {
"total_count": 1
}
},
"id": "{user_id}_{post_id}"
}
I got this answer from this post.
It seems that the Facebook API does not support getting reactions on Photos using the shorthand id, but it supports getting reactions using the longhand id, which is {user_id}_{post_id}.
I have a GraphQL query that calls a REST service to get the return object. The query contains an Id parameter that is then passed to the service. However, the REST service can respond with http status 404 Not Found if an object with that Id does not exist. That seems like the right response.
How do you model a Not Found response in GraphQL?
Is there a way to inform the GQL caller that something does not exist?
Update
Some options I am considering:
Return null
Change the GrqlhQL Query to return a list of objects and return empty list of nothing is found
Return some kind of error object with an error code
but it is unclear if there is a recommended practice in GQL API design.
You might treat it as an error and handle it accordingly.
I recommend you to check the GraphQL spec, the paragraph about error handling.
I hope it contains exactly what you are looking for.
Basically, you should return whatever you could, and inform a client about potential problems in the "errors" field.
The example from the documentation:
Request:
{
hero(episode: $episode) {
name
heroFriends: friends {
id
name
}
}
}
Response:
{
"errors": [
{
"message": "Name for character with ID 1002 could not be fetched.",
"locations": [ { "line": 6, "column": 7 } ],
"path": [ "hero", "heroFriends", 1, "name" ]
}
],
"data": {
"hero": {
"name": "R2-D2",
"heroFriends": [
{
"id": "1000",
"name": "Luke Skywalker"
},
{
"id": "1002",
"name": null
},
{
"id": "1003",
"name": "Leia Organa"
}
]
}
}
}
I'm currently trying to get all the appointments users requested on my page.
So I set up a Webhook to get them in real time to then save them into my database:
GET /v3.2/{id_page}/subscribed_apps path send me this response so I'm well subscribed:
{
"data": [
{
"link": "linktopage",
"name": "pagename",
"id": "idpage",
"subscribed_fields": [
"messaging_appointments",
]
}
]
}
Now the problem is, Facebook send me this when someone request an appoinment :
{
"object":"page",
"entry":[
{
"id":"idpage",
"time":1552015328847,
"messaging":[
{
"sender":{
"id":"idsender"
},
"recipient":{
"id":"idpage"
},
"timestamp":1552015327245,
"message":{
"mid":"idmessage",
"seq":223007,
"attachments":[
{
"title":"Appointment Request",
"url":null,
"type":"fallback",
"payload":null
}
]
}
}
]
}
]
}
Facebook doesn't send me the date for the appointment, nor the duration, and I need those informations. (Time and timestamp indicate when the webhook occurred)
When I try to get the message with mid with path GET /v3.2/{message-id}, the api tells me
"(#803) Some of the aliases you requested do not exist: idmessage"
Is there something I'm doing wrong? Thanks
Trying to get the impressions per notification of specific group(by using ref).
By the api you can set a group for notifications by adding ref param to the notification request
That worked fine.
Now i am trying to use the API for getting insights as explained here:
insights
I still dont understand how to pass the ref param.
this is my execution:
../app_insights/app_notification_impressions?breakdowns[0]=ref&access_token={access-token}
And in return I get this:
{
"data": [
{
"time": "2014-12-09T08:00:00+0000",
"value": "44",
"breakdowns": {
"ref": "no_ref_specified"
}
}
]
}
How I am passing the request the ref value?
I tried all kind of combinations and I get errors.
I posted notification with diff ref. ref=test0099 and Now I see this:
{
"data": [
{
"time": "2014-12-09T08:00:00+0000",
"value": "3",
"breakdowns": {
"ref": "no_ref_specified"
}
},
{
"time": "2014-12-10T08:00:00+0000",
"value": "1",
"breakdowns": {
"ref": "test0099"
Maybe there is some bug over there?
thanks,
ray.
Edit:
Stating your findings
for some reason you cant notify with ref which is only numeric or start with numeric
Again, it still comes to down to file a bug.
From IRC, just stating that you should file a bug.
As long as the app is a canvas app and a game you should be able to see the desired response
HTTP POST /13608786/notifications with App Token and
template=Yo this is a test
ref=test0099
You should receive the notification
And be redirected to the canvas page
https://apps.facebook.com/philippeharewood/?fb_source=notification&fb_ref=test0099&ref=notif¬if_t=app_notification
The insights will reflect the same
HTTP GET /app/app_insights/app_notification_impressions?breakdowns[0]=ref
{
"data": [
{
"time": "2014-12-10T08:00:00+0000",
"value": "1",
"breakdowns": {
"ref": "test0099"
}
}
]
}
This issue apparently to be a bug.
I have assigned this into facebook developers and now they taking care of it.
tracking at: https://developers.facebook.com/bugs/1512426199028095
I'm trying to create a report definition using the GoodData REST API. I use the following endpoint to invoke the rest call.
"/gdc/md/{project-id}/obj"
When i try to invoke the API call with the following dataset in which the projectId and the userId are valid, it gives me the error with the response code 500.
{
"reportDefinition": {
"content": {
"filters": [],
"format": "grid",
"grid": {
"rows": [],
"columns": [
"metricGroup"
],
"sort": {
"columns": [],
"rows": []
},
"columnWidths": [],
"metrics": [
{
"uri": "/gdc/md/qy48iv4flikdlcwpwioizuip74wt8nb5/obj/63f3cecd2a8d3ce2ec9378381c8f39e3",
"alias": ""
}
]
}
},
"meta": {
"title": "Sample report definition",
"summary": "This is a sample report",
"tags": "",
"deprecated": 0,
"category": "samplecategory"
}
}
}
{
"error": {
"message": "Internal server error. Please fill in bug report with request_id='lp78FL5S1IPMqB2n'"
}
}
I'm certain that the user project_id and the user_id are valid. Is this an error in the API?
Thank you in advance.
Apart from the metrics URI that looks weird (hash instead of numeric ID), I was able to dig in our logs an error that says: "Category is not equal to tag structure".
In your example you have its value set to "samplecategory". "category" property defines what type of object are you creating. If you are creating a report definition it should have value of "reportDefinition".
Last time I worked with GoodData API, metrics had numeric IDs. That seems most likely to be the culprit. Where did you get "/gdc/md/qy48iv4flikdlcwpwioizuip74wt8nb5/obj/63f3cecd2a8d3ce2ec9378381c8f39e3" from, especially the "63f3cecd2a8d3ce2ec9378381c8f39e3" part?