Google url shortener api and jquery not working?

You need API key in order to use this API This method requires one query parameter: Your API key (using the key query parameter). Note: You can omit the query parameter when making a limited number of calls, such as during the testing phase. Also response return in JSON $.

Post("https://googleapis.com/urlshortener/v1/url?key=e..., { longUrl: "google.com/"}, function(data){ console. Log("data" + data); }, "json").

I assume you have read the Google URL Shortener API reference instructions, but I do not see an API key in your code snippet: POST https://googleapis.com/urlshortener/v1/url?key={....

Not mandatory pal. But highly recommended – naveen Jan 14 at 4:20 good information to know, thanks. – tawman Jan 14 at 4:27 yes I have tried sending the key in the URL as well as a post param with the same result – rahim Jan 14 at 19:18.

Try setting the contentType, like this: $. Ajax({ type: 'POST', contentType: "application/json" url: "https://googleapis.com/urlshortener/v1/url", data: { longUrl: "google.com/"}, success: success, dataType: "jsonp" }).

Try using getJson Method: url="https://googleapis.com/urlshortener/v1/url"; data = { key:"your-api-key", shortUrl:"google.com" }; $. GetJSON(url, data, function(data, textStatus){ if(data. Status=="OK"){ alert(data.

LongUrl); } }).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions