Facebook ads custom audience Data is missing or does not match schema error - api

i was building a integration with the facebook ads audience API, and according the documentation the request must be created like this:
POST - https://graph.facebook.com/v15.0/<MY_CUSTOM_AUDIENCE_ID>/users?access_token=<MY_ACCESS_TOKEN>
{
"session":{
"session_id":1,
"batch_seq":1,
"last_batch_flag":true,
"estimated_num_total":1
},
"payload":{
"schema":[
"FN"
],
"data":
[
"8b1ebea129cee0d2ca86be6706cd2dfcf79aaaea259fd0c311bdbf2a192be148"
]
}
}
Using the previus example a received a error 400:
{
"error": {
"message": "(#100) Data is missing or does not match schema",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AqrLd9uIw0D4BBFtHF33bdU"
}
}
For do this i used this documentation https://developers.facebook.com/docs/marketing-api/audiences/guides/custom-audiences#hash
Anyone has use this before?

Your schema field type is array but array use form multi-key qualification.
Change it to string: schema: 'FN'
In docs you can see all formats.
This payload with multi keys work for me:
{
"session": {
"session_id": 123,
"batch_seq": 1,
"last_batch_flag": true
},
"payload": {
"schema": [
"EMAIL",
"PHONE",
"FN"
],
"data": [
["EMAIL_HASH", "PHONE_HASH", "FN_HASH"]
]
}
}

Related

whatsapp api error during sending an created template

{ "messaging_product": "whatsapp",
"to": "91********5",
"type": "template",
"template": {
"name": "demo_template",
"language": {
"code": "en_US"
}
}
}
This is passed as a post method.
demo_template is an existing template created by me.
Getting error like this:
{
"error": {
"message": "(#132012) Parameter format does not match format in the created template",
"type": "OAuthException",
"code": 132012,
"error_data": {
"messaging_product": "whatsapp",
"details": "header: Format mismatch, expected IMAGE, received UNKNOWN"
},
"error_subcode": 2494073,
"fbtrace_id": "ARtWScjGa0rADjfHvbOH4bS"
}
}
For image you have to first upload the image in media library then you can get id for the media you have uploded then you can attach that id with the messaging template you send out in headers in your case it is image.check this link here
or you can directly use url link to attach media.{ "type": "header", "parameters": [ { "type": "image", "image": { "link": "https://URL" } } ] },
The parameter values included in the request are not using the format specified in the template. See the Message Template Guidelines.

MFP 8 - error parsing JSON object when using MobileFirst Push API

I am getting the following error when I tried to used the push API to send a notification. The JSON object works in version V7.1
{
"code": "FPWSE0011E",
"message": "Bad Request - The JSON validation failed at 'target'.",
"productVersion": "8.0.0.00-20161122-1902"
}
Here is my JSON object
{
"message": {
"alert": "hello"
},
"settings": {
"apns": {
"badge": 1,
"iosActionKey": "Ok",
"payload": {
"messageType": "HELLO",
"detail": "Here's your message details."
},
"sound": "song.mp3"
},
"gcm": {
"payload": {},
"sound": "song.mp3"
}
},
"target": {
"consumerIds": [],
"deviceIds": ["4A1086CF-873A-4404-BE2D-200EA6BDA8AD"],
"platforms": [
"A","G"
]
}
}
I am using the admin RestAPi interface
https://myserver/mfpadmin/management-apis/2.0/runtimes/mfp/notifications/applications/com.myjobs/messages
I followed the format from the documentation
http://www.ibm.com/support/knowledgecenter/SSHS8R_8.0.0/com.ibm.worklight.apiref.doc/apiref/r_restapi_send_message_post.html
Thanks for your help
According to the v8.0 documentation only 1 property is allowed in target. In your JSON I see several properties are defined.
See example JSON here: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/#sending-notifications
And as can be seen:
target" : {
// The list below is for demonstration purposes only - per the documentation only 1 target is allowed to be used at a time.
"deviceIds" : [ "MyDeviceId1", ... ],
"platforms" : [ "A,G", ... ],
"tagNames" : [ "Gold", ... ],
"userIds" : [ "MyUserId", ... ],
},

Using the advanced query api and get all pages back

I can successfully call into an advanced query method and get the first page of data back (using the post option) refernced in http://api.docs.import.io/#QueryMethods
Anyone have an idea how to page after that? I get 20 out of 190 results. My query looks like:
var query = {
"input": { "last_name": name },
"additionalInput": {
"8d817939-my-api-key-9502ed72": cookie
},
"returnPaginationSuggestions": true
}
Where param name and cookie are known vars.
The results do not return a pagination block either as in the model result:
{
"connectorVersionGuid": "string",
"pagination": {
"pattern": "string",
"next": "string",
"currentPageNum": 0,
"previous": "string"
},
"connectorGuid": "string",
"totalResults": 0,
"errorType": "TimeoutException",
"outputProperties": [
{
"type": "STRING",
"name": "string"
}
],
"cookies": [
"string"
],
"results": [
{}
],
"pageUrl": "string",
"error": "string",
"data": {}
}
If the response is not returning the "Pagination" block, it means that the system was not able to identify pagination on a given page.
As far as I remember pagination is flaky for Extractor APIs, while it works quite well for Magic APIs. I would recommend trying to get a Magic extractor, and getting pagination suggestions for it. Than you should be able to get the "Pagination" block in your response, and use "next" value to get the URL of the next page.

Invalid Path error while inserting job from google cloud storage to google bigquery

I am trying to insert a job through HTTP Post request, but i am getting Invalid path error.
My request body is as follows:
{
"configuration": {
"load": {
"sourceUris": [
"gs://onianalytics/PersData.csv"
],
"schema": {
"fields": [
{
"name": "Name",
"type": "STRING"
},
{
"name": "Age",
"type": "INTEGER"
}
]
},
"destinationTable": {
"datasetId": "Test_Dataset",
"projectId": "lithe-anvil-404",
"tableId": "tb_test_Pers"
}
}
},
"jobReference": {
"jobId": "10",
"projectId": "lithe-anvil-404"
}
}
For the sourceuri parameter, I am passing "gs://onianalytics/PersData.csv", where onianalytics is my bucket name and PersData.csv is my csv file (from which I want to upload data into google bigquery).
I am getting below response:
"status": {
"state": "DONE",
"errorResult": {
"reason": "invalid",
"message": "Invalid path: gs://onianalytics/PersData.csv"
},
"errors": [
{
"reason": "invalid",
"message": "Invalid path: gs://onianalytics/PersData.csv"
}
]
},
"statistics": {
"creationTime": "1387276603674",
"startTime": "1387276603751",
"endTime": "1387276603751"
}
}
My bucket is under the same projectid which has the BigQuery service activated. Also, I have Google Cloud Storage enabled under APIs and Auth. Following scopes are added while authenticating:
googleapis.com/auth/bigquery, googleapis.com/auth/cloud-platform, googleapis.com/auth/devstorage.full_control,googleapis.com/auth/devstorage.read_only,googleapis.com/auth/devstorage.read_write
I am inserting this job by "Try it!" link which is available on developers.google.com/bigquery/docs/reference/v2/jobs/insert.
In fact I am able to create buckets and objects in goggle cloud storage through APIs. But when i try to insert job from the uploaded object (which is a csv file), i got "Invalid Path" error. Can anyone please help me to identify why this error is occurring?
The error I get when trying the code above is "Not found: URI gs://onianalytics/PersData.csv".
I'm wondering if instead of /onianalytics/ you had a different path with invalid characters?

Error JSONP Store

I am retrieving information for a List via JSONP and am getting the following error in console browser: "unexpected token : "
My store:
Ext.define ('Projeto.store.Mural', {
extend 'Ext.data.Store'
requires: [
'Projeto.model.Mural'
]
config: {
autoLoad: true,
model: 'Projeto.model.Mural'
storeId 'MuralStore'
Proxy {
type: 'jsonp'
url: 'http://URL/mural'
reader: {
type: 'json',
rootProperty: 'rows'
}
}
}
});
My List:
Ext.define ('Projeto.view.MuralList', {
extend 'Ext.dataview.List'
alias: 'widget.murallist'
config: {
loadingText: 'Loading ...',
store: 'MuralStore'
itemTpl: [
'<div> Message: {message} </ div>
]
}
});
JSON returns my URL:
{
"rows": [
{
"lookup": "yyyy"
"dateTime", "10/10/1970"
"id": "1",
"message": "yyyy"
}
{
"lookup": "dsdfasfsadf"
"dateTime", "15/05/2012"
"id": "2",
"message": "dsdfasfsadf"
}
]
}
Does anyone know why the error, because JSON is in a valid format.
Thank you.
You're missing a comma in the middle :
{
"rows": [
{
"lookup": "yyyy"
"dateTime", "10/10/1970"
"id": "1",
"message": "yyyy"
},
{
"lookup": "dsdfasfsadf"
"dateTime", "15/05/2012"
"id": "2",
"message": "dsdfasfsadf"
}
]
}
My guess is that the service you're accessing returns JSON but not JSONP. Search the jsonp tag for "unexpected token". You'll find e.g. Why is this JSONP feed throwing "Unexpected Token" error?
Firstly, You'r missing ':' at many places and also ',' at the end of statements. It always good practise to use : before the property value and , at the end of statement.
Like this,
...
...
requires: [
'Projeto.model.Mural'
],
config: {
autoLoad: true,
model: 'Projeto.model.Mural',
storeId: 'MuralStore',
proxy : {
type:'jsonp',
},
....
....
Secondly, this error is occuring because your response is not a VALID jsonp response.
When I checked on jsonplint.com, it showed me this error
Invalid JSONP
No callback function defined
Improper or no closing
So, either you need to make sure that you have a valid callback function defined.
Otherwise, you could do one thing. Change the type:'jsonp' to type:'ajax' and that should resolve your problem without having to change anything else.
Since you are requesting it as jsonp, not just json, it expects your json to be enclosed in a callback function. Something like:
callback({
"rows": [
{
"lookup": "yyyy"
"dateTime", "10/10/1970"
"id": "1",
"message": "yyyy"
}
{
"lookup": "dsdfasfsadf"
"dateTime", "15/05/2012"
"id": "2",
"message": "dsdfasfsadf"
}
]
})