Sobes.tech
Junior — Middle

Which HTTP method and headers should be used for a request to an API that returns customer information based on their card number?

sobes.tech AI

Answer from AI

For an API request that returns customer information based on a card number, the GET HTTP method is usually used, as the request is intended to retrieve data.

Example headers:

  • Accept: application/json — to indicate that the client expects a JSON response.
  • Authorization: Bearer <token> — if the API requires authentication.

Example request:

GET /api/client?cardNumber=1234567890123456 HTTP/1.1
Host: example.com
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

It is important not to send the card number in the request body or headers, but to use URL parameters if it is safe and complies with security requirements.

Which HTTP method and headers should be used for a… - sobes.tech