Hacker News new | ask | show | jobs
by ramonverse 666 days ago
I used your free api and the response gives no insights, is that how it is supposed to work?

e.g. [ { "url": "https://pretzelai.github.io", "host": "pretzelai.github.io", "status": 200, "statusText": "OK", "duration": "0.167 s", "location": null } ]%

1 comments

Yes, that's correct. The API returns JSON data showing the final destination and status. If there were redirects, you'd see multiple entries in the array.
Example:

    [
      {
        "url": "https://bit.ly/abc",
        "host": "bit.ly",
        "status": 301,
        "statusText": "Moved Permanently",
        "duration": "0.156 s",
        "location": "http://www.yahoo.com/"
      },
      {
        "url": "http://www.yahoo.com/",
        "host": "www.yahoo.com",
        "status": 301,
        "statusText": "Moved Permanently",
        "duration": "0.081 s",
        "location": "https://www.yahoo.com/"
      },
      {
        "url": "https://www.yahoo.com/",
        "host": "www.yahoo.com",
        "status": 200,
        "statusText": "OK",
        "duration": "0.488 s",
        "location": null
      }
    ]
Redirected from bit.ly to HTTP yahoo.com and then redirected to HTTPS yahoo.com