Where should an API key go in a request?
QuizEasy-MediumAsked in: Accenture, Capgemini, Infosys
An API accepts an API key either in a header or as ?api_key=... in the URL. Which is the better choice, and why?
- A header such as X-API-Key, because URLs are stored in server logs, proxy logs and browser history
- The query string, because it is encrypted and headers are not
- The request body of a GET request
- It makes no difference at all
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.