Redirects API

The redirects API fetch the redirect chain with status code for any URL which has 3xx temporary or permanent redirect. The API will also capture browser redirects using JavaScript, meta tags or other client side redirect mechanism.

The /redirects API support both GET and POST methods and you’ll get the whole redirect chain in response JSON.

Code

See the request schema here

const fetch = require('node-fetch');

const body = {
  "url": "https://httpbin.org/redirect/2",
  "gotoOptions": {
    "timeout": 10000,
    "waitUntil": "load"
  }
};

fetch('https://chrome.agenty.com/redirects?apiKey={{API_KEY}}', {
        method: 'post',
        body:    JSON.stringify(body),
        headers: { 'Content-Type': 'application/json' },
      })
      .then(res => res.json())
      .then(json => console.log(json));

Response

[
    {
        "url": "https://httpbin.org/redirect/2",
        "status": 302
    },
    {
        "url": "https://httpbin.org/relative-redirect/1",
        "status": 302
    },
    {
        "url": "https://httpbin.org/get",
        "status": 200
    }
]