See code snippet below. I got (#100) param data must be an array when calling to the API. data parameter must be a JSON array according to their reference.
https://developers.facebook.com/docs/marketing-apis/offline-conversions/v2.8
I can’t find out where I am wrong.
$("#btn4").click(function(){
$.ajax({
type: "POST",
//dataType : "json",
url: "https://graph.facebook.com/v2.8/xxxxxxxx/events?access_token=xxxxxx&HTTP/1.1&account_id=xxxxxx&business=xxxxxxx&data=[{'event_name':'Lead','event_time':1456870055,'currency':'USD','match_keys':{'email': [[email protected]]}}]&upload_tag=special-offer", // get ad id from ad in ads manager
success: function(result){
// do something
}});
});
2
Answers
I was getting this issue and it ended up being unrelated to the data. After sending the same data in three times it finally asked me to accept the terms and service at https://business.facebook.com/offline_events/?business_id=***********&show_tos=1 in an error message. Once I accepted it worked fine. If you haven’t gone there (with your business_id replacing the asterisks, of course) it’s worth a shot. Good luck!
The API takes a “JSON String” rather than just JSON, so data=[] becomes data=”[]”