Getting data from API

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: '',
  headers: {
    'content-type': 'application/x-www-form-urlencoded',
    'x-rapidapi-host': '',
    'x-rapidapi-key': 'b48883481fmsh5673bb460c7c864p19181cjsnc8adea593e65'
  data: {url: ''}

axios.request(options).then(function (response) {
}).catch(function (error) {

URL Shortener

Without taking a look at the api manual, for me it looks like you have a dismiss between content type and data. Content type ist form-url-encoded, while your data looks like JSON.

You should check out which type the api is asking for and change the content type to application/json or change the data to be form data.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.