I want to send mail using zapier with mailchimp.
What I did:
In my webiste I put ajax request and add zapier webhook.
$.ajax({
url: "https://hooks.zapier.com/hooks/catch/xzyabc/", // this is zapier webhook
type: "POST",
data: zapierData,
success: function(result) {
console.log('Zapier Success: ', result);
},
errors: function(error) {
console.log('Zapier Error:', error);
}
});
What else I need to do please explain step by step if anybody knows ?
Thanks,
Related
if my username is name123#test.com and API token is 123456789 then how to create a get request for retrieving tickets related to the user
I tried this way and got always unauthorized as response
$.ajax({
url: 'https://mysubdomain.zendesk.com/api/v2/requests.json',
beforeSend: function (request) {
request.setRequestHeader("Authorization", "Basic
name123#test.com;123456789");
request.setRequestHeader('Content-Type', 'application/json');
},
success: function (data) {
console.log( data);
},
error: function (err) {
console.log(err);
}
})
As per the documentation here, the proper format for using tokens is {email_address}/token:{api_token}, as in jdoe#example.com/token:6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv. So looks like you need to add /token and the ; semicolon should be replaced with a : colon.
I have been trying to post an attachment on Yammer using Yammer Javascript api. There is not much documentation available on Yammer regarding this. Can someone help me to achieve this.
Thanks.
Hopes this may help you to solve the issue,
You can use POST:/pending-attachments yammer API for posting the images in yammer.
But If you want to create yammer post with images, POST:/messages.json can be used with attaching files - attachment_N or pending_attachment_N as a multipart form field.
Use this link for info - Yammer message API
adding a sample code using JavaScript SDK -
let otherFormData = {
"group_id": groupId,
"body": message,
"og_url": postUrl,
"og_fetch": false,
"og_title": title,
"og_image": og_image,
"og_description": summary,
"og_object_type": og_object_type,
"direct_to_user_ids": []
};
let formData = new FormData();
formData.append("attachment1", imgData_Base64, AfileName);
for (let i in otherFormData) {
formData.append(i, otherFormData[i]);
}
window.yam.platform.request({
url: "messages.json",
method: "POST",
data: formData,
processData: false,
contentType: false,
type: 'POST',
dataType: 'json',
success: (response) => {
console.info("The request is successful. ", response);
},
error: (err) => {
console.info("There is an error in the request.", err);
}
});
Im making a Login whit facebook.
using the javascript sdk im geting the response (i guess is JSON), and i want to send this response to a php file to check if the user is in the database or not.
so heres what i got so far.
this is the function i call when the user is loged into facebook.
function testing(){
FB.api('/me', function(response) {
response = JSON.stringify(response);
//call another function, sending the data recived
ajaxlog(response);
});
}
and here is the ajaxlog function
function ajaxlog(facedatos){
$.ajax({
type: "POST",
url: "facebook-ajax-login.php",
dataType: "json",
data: facedatos,
success: function(response){
//the php brings the conect response true or false
if(response.conect==true){
$("#exist").html(response.data);
}else{
}
},
beforeSend: function(){
$("#exist").html("<img class='img-responsive ajax-l' style='width:40px;padding-top:10px;margin-right:10px;' src='images/ajax-loader.gif' />")
}
});//<!--ajax-->
im doing alerts and the facebook data comes with no problem. i think the issue is how i send the data by post, im not reciving the data in the php
I find the issue by myself,
the problem is that i was sending the post request whitout a name.
in the ajax function changed
data: facedatos,
for
data:{
face: facedatos
}
and in the php recived the data as $_POST["face"];
I need to include a header with a refresh token in an ajax call to the YouTube api. I am trying to send a delete request, to delete a movie I have on my account. This is my ajax call that fire on button click
jQuery.ajax({
type: 'DELETE',
// must set api key
url: 'https://www.googleapis.com/youtube/v3/videos?id='+ thisUniqueID + '&key=904907387177-qe517sq5dmmpebckjbmrhv4gvac9e2d1.apps.googleusercontent.com',
success: function() {
alert('your video has been deleted');
},
error: function() {
alert('error processing your requst');
}
});
I am receiving a 401 (unauthorized) erorr on return and it seems that I need to include my access token in the call. I was playing around with the google api playground looking at the request and response and this is what shows as the 'Request' being sent out
DELETE https://www.googleapis.com/youtube/v3/videos?id=3242343&key={YOUR_API_KEY}
Authorization: Bearer "access token"
X-JavaScript-User-Agent: Google APIs Explorer
Now from that request it looks like the there are headers that are being sent with the request, which hold the access token. This must be why I am getting a 401 error. How can I include those headers into my ajax request, so that my access token is passed along with the request? Thanks
I was able to pass along a header using this code below:
jQuery.ajax({
type: 'DELETE',
// must set api key
url: 'https://www.googleapis.com/youtube/v3/videos?id='+ thisUniqueID +'&key=api_key_here',
beforeSend: function(xhr){xhr.setRequestHeader('Authorization', 'Bearer access_token_here');},
success: function() {
alert('your video has been deleted');
},
error: function() {
alert('error processing your request');
}
});
You can use beforeSend method and request.setRequestHeader. Take a look at the official documentation here.
P.S. should I post it as a comment?
Try add the paramenter data.
jQuery.ajax({
type: 'DELETE',
data: 'key=' + {YOUR_API_KEY},
// must set api key
url: 'https://www.googleapis.com/youtube/v3/videos?id='+ thisUniqueID + '&key=904907387177-qe517sq5dmmpebckjbmrhv4gvac9e2d1.apps.googleusercontent.com',
success: function() {
alert('your video has been deleted');
},
error: function() {
alert('error processing your requst');
}
});
I make a request with Ajax and the request works fine when I use GET. It doesn't if I use POST in my script and my Rest-Service.
$.ajax({
type: 'POST',
url: 'http://localhost/WebRestService/rest/User/deletePC',
dataType: "text",
success: function(antwort){
alert("response:"+antwort);
if (window.DOMParser)
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(antwort,"text/xml");
}
else // Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(antwort);
}
},
error:function(x,e){
if(x.status==0){
alert('You are offline!!\n Please Check Your Network.');
}else if(x.status==404){
alert('Requested URL not found.');
}else if(x.status==500){
alert('Internel Server Error.');
}else if(e=='parsererror'){
alert('Error.\nParsing JSON Request failed.');
}else if(e=='timeout'){
alert('Request Time out.');
}else {
alert('Unknow Error.\n'+x.responseText);
}
}
});
If I use POST I get an unknown error. What is the problem?
THX!
Edit: DELETE and PUt also doesn't work.
Edit2: if I use firefox Poster it works fine.
My where is you data that you are sending in your ajax request?
When you send post request you have to identify your data that you are sending.
You are missing data attribute of post request.
$.ajax({
type: 'POST',
url: 'http://localhost/WebRestService/rest/User/deletePC',
data:'some data',
dataType: "text",
success: function(antwort){
alert("response:"+antwort);
},
});
For further reading consult here