Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Examples of API response to webapp

Template

{
  success: boolean,
  data: T,
  error: string, // could be message or i18n code
  errorCode: string, // error code to allow the page to behave according to the error (like show a retry or undo button)
  tracking: string // simple code to allow the user to open a ticket
}

Successful response

{
  "success": true,
  "data": {
    "name": "Wesley",
    "lang": "Java"
  },
  "tracking": "WXYZ-9999"
}

Failure response with text

{
  "success": false,
  "tracking": "WXYZ-9999",
  "error": "Invalid name"
}

Failure response with i18n code

{
  "success": false,
  "tracking": "WXYZ-9999",
  "error": "i18n.users.name.invalid"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.