'confusion between post and get method [closed]

I'm creating an API which accepts customerid, account number and date as json objects and returns a file whose location is mentioned in the database corresponding to it.

I'm confused about which method I need to use: GET OR POST. I am still learning to create APIs.



Solution 1:[1]

Since you are trying to Query and Fetch something. GET is a good choice.

REST Verb   Action
- - - - - - - - - - 
GET         Fetches a record or set of resources from the server
OPTIONS     Fetches all available REST operations
POST        Creates a new set of resources or a resource
PUT         Updates or replaces the given record
PATCH       Modifies the given record
DELETE      Deletes the given resource

The detailed explain or guide, you can refer to: https://hevodata.com/learn/rest-api-best-practices/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 azro