samedi 20 juin 2015

I can't use the Google URL Shortener API to shorten a long URL

I am using jQuery on my web app and when I try to use the goo.gl API, I get this error:

{
  "error": {
       "code": 404,
       "errors": [
         {
             "domain": "global",
             "location": "shortUrl",
             "locationType": "parameter",
             "message": "Required parameter: shortUrl",
             "reason": "required"
         }   
        ]
   }

I use jquery to "POST" to the API to get a short URL from a long one. The code I use is:

$.ajax({
url:"http://ift.tt/1IqO1i5",
data:{"fields":"id", "key":"MY_KEY"},
success: function(k) {
var myShortUrl = k;
}, 
contentType:"application/json"});




Aucun commentaire:

Enregistrer un commentaire