Skip to content

Incorrect HTTP method usage (POST instead of GET)

Description:

Many route endpoints currently require POST requests despite not performing any data-saving operations. POST requests should primarily be used for creating or modifying resources. For routes where data is only fetched from the server (no state change), the correct HTTP method to use is GET.

Using POST inappropriately can lead to misunderstandings regarding API behavior and caching inefficiencies.

Expected behavior:

  • Use GET requests for all routes that merely retrieve data without altering server-side data.
  • Reserve POST requests exclusively for operations that create or update resources on the server.

Examples:

The following routes require POST requests even though they only return already existing data and do not update/create any data on the server

  • /getDependency
  • /get_hotspot
  • /get_hotspots
  • /get_mediapages

Suggested solution:

Review all route endpoints and update HTTP methods accordingly:

  • Identify endpoints incorrectly set as POST.
  • Refactor these endpoints to accept GET requests.
  • Update client-side code to ensure compatibility with the corrected method.