diff --git a/README.MD b/README.MD index d7817c1..4494b1c 100644 --- a/README.MD +++ b/README.MD @@ -37,6 +37,7 @@ we help them solve their problem and then together write either a [Standard] or - [[MO] Test your React and React Native components' state with Jest (without Enzyme)](/code-quality/components-state-testing.mo.md) - [[Standard] Pull Request Template](/code-quality/pull-request-template.s.md) - [[Standard] Test files indentation](/code-quality/test-files-indentation.s.md) +- [[MO] How to correctly call an API](/code-quality/api-call-checklist.mo.md) ## Flowtype diff --git a/SUMMARY.MD b/SUMMARY.MD index 34b09c9..6cfaf51 100644 --- a/SUMMARY.MD +++ b/SUMMARY.MD @@ -16,6 +16,7 @@ - Code Quality - [[MO] Test your React and React Native components' state with Jest (without Enzyme)](/code-quality/components-state-testing.mo.md) - [[Standard] Test files indentation](/code-quality/test-files-indentation.s.md) + - [[MO] How to correctly call an API](/code-quality/api-call-checklist.mo.md) - Flowtype - [[Standard] Flowtype](/flowtype/flowtype.s.md) - Project Standards diff --git a/code-quality/api-call-checklist.mo.md b/code-quality/api-call-checklist.mo.md new file mode 100644 index 0000000..c5aef16 --- /dev/null +++ b/code-quality/api-call-checklist.mo.md @@ -0,0 +1,44 @@ +# [MO] What to check when making an API call + +## Owner: [Yassine Chbani](https://www.github.com/yassinecc) + +## Prerequisites + +* [] Have the API's documentation + +## Steps + +Note: Do not assume that the documentation is complete, if you are uncertain about something get in touch with the API's authors + +* [ ] I know which parameters are mandatory/optional in my call +* [ ] From each parameter, I know: + +- its type +- its format +- whether it is mandatory or optional +- its maximal/minimal values +- its signification in the API + +* [ ] I know how will each parameter be interpreted (Ex: a request that needed a vehicle's mileage expected a string between 0 for 0% and 8 for 100%) +* [ ] I have tested the API request on all environments (staging/production) (Ex: a request with a SOAP client succeeds in staging but not in production => we had to do a POST request with an XML body) +* [ ] I know how to distinguish between success and failure cases of the API request (Ex: the API's response is an XML one with the error tag written as an 'Error' string) +* [ ] I have tested my request with parameters that lead to successful and failure responses (Ex: Due to a defective catch statement, we received an OK response from a login routine no matter what password was used) +* [ ] I have a real-life dataset with which I can test the API (Ex: testing with mock data is not representative of real-life use cases, the best is to test the API call from within the associated user path) +* [ ] If I need authentication, I have checked that the authentication credentials will always be available when the request is made, otherwise the users can authentiate themselves +* [ ] For chaque response element, I have checked: + +- its type +- its format +- whether it is mandatory or optional +- its maximal/minimal values +- its signification in the API +- its pagination: will we receive all data at once or in multiple requests + +* [ ] I have taken into account the following response cases: + +- An object returned with its correct format +- An object with an incorrect format (ex: missing key, wrong date format) +- A non-JSON response +- An empty response +- A 500 error +- A 400 error