Created
April 4, 2012 12:05
-
-
Save imikay/2300688 to your computer and use it in GitHub Desktop.
API design
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The data returned from an API should have a similar structure like the following: | |
Success: | |
{status: 1, data: [A collection of data]} | |
Error: | |
{status: 0, error: { code: 1, message: 'critical error' }} | |
And the data returned must always have a consistent structure, for example, an image API | |
should always return a data structure like this: {title: A fancy image, link: http://www.example.com}, | |
the title and link property must always present in the data, no matter whether they have a value or not. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment