I am using an api URL Shortener. How can I access the data from the API. What should I edit on my code?
My code:
var axios = require("axios").default;
var options = {
method: 'POST',
url: 'https://url-shortener-service.p.rapidapi.com/shorten',
headers: {
'content-type': 'application/x-www-form-urlencoded',
'x-rapidapi-host': 'url-shortener-service.p.rapidapi.com',
'x-rapidapi-key': 'b48883481fmsh5673bb460c7c864p19181cjsnc8adea593e65'
},
data: {url: 'https://google.com/'}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
URL Shortener
https://rapidapi.com/BigLobster/api/url-shortener-service/