How to design your REST API endpoint
[A Thread]
[A Thread]
https://twitter.com/thebiggergeek/status/1267205668408262663?s=21
Now">https://twitter.com/thebigger... let me clear this. Let’s say you’re calling Paystack API to charge a tokenised card.
If can either be “transaction successful” or “insufficient funds” you will need to different between these using the Boolean. https://twitter.com/thebiggergeek/status/1267205668408262663">https://twitter.com/thebigger...
Now">https://twitter.com/thebigger... let me clear this. Let’s say you’re calling Paystack API to charge a tokenised card.
If can either be “transaction successful” or “insufficient funds” you will need to different between these using the Boolean. https://twitter.com/thebiggergeek/status/1267205668408262663">https://twitter.com/thebigger...
After all from Paystack, the only success you need is “Transaction successful”.
It could be success and your customer has insufficient funds or card has expired.
It could be success and your customer has insufficient funds or card has expired.
With permission from @mykeels
Summary: status key wouldn’t be necessary if you return the right startup code for everything.
There’s a status code for every scenario
Summary: status key wouldn’t be necessary if you return the right startup code for everything.
There’s a status code for every scenario
Moral lesson:
• Always return the right status code
• Structure your response object properly
• Avoid unnecessary data nesting
P.S: I may be wrong, please correct me.
• Always return the right status code
• Structure your response object properly
• Avoid unnecessary data nesting
P.S: I may be wrong, please correct me.