Last active
October 14, 2017 02:46
-
-
Save shahzadns/cf37c2a8edc2612820219a0430565fa1 to your computer and use it in GitHub Desktop.
Revisions
-
shahzadns revised this gist
Oct 14, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,12 +19,12 @@ var res = { // client-side - 400 (payload missing), 401(invalid payload), 403 (unauthorized), // server-side - 500 (internal error - script code breaks), 503 (service unavailable - server is down) var res = { code: 'ESU1', //Error Sign Up - email already exist, and similar stuff. (FE should map the given error) messages: ['sign-up failed', 'email exists'] }; // upload excel file error example - or any similar stuff that can have multiple errors (other example. BE validation) var res = { code: 'ERU1', //Error Records Upload - partial success - (FE should map the given error) messages: ['line#54 failed', 'line#63 failed', 'line#100 failed'] }; -
shahzadns revised this gist
Oct 14, 2017 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,11 @@ /** * Created on: Oct 14 2017 * Created by: Shahzad Nawaz * Derived from different sources, Stakoverflow, Blogs, experience. * For more advanced handling - checkout https://github.com/adnan-kamili/rest-api-response-format */ // success response example - http status code - always 200 var res = { code: '200', -
shahzadns revised this gist
Oct 14, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,12 +11,12 @@ var res = { // client-side - 400 (payload missing), 401(invalid payload), 403 (unauthorized), // server-side - 500 (internal error - script code breaks), 503 (service unavailable - server is down) var res = { code: 'ESU1', //Error Sign Up - email already exist, and similar stuff. (FE will map the given error) messages: ['sign-up failed', 'email exists'] }; // upload excel file error example - or any similar stuff that can have multiple errors (other example. BE validation) var res = { code: 'ERU1', //Error Records Upload - partial success - (FE will map the given error) messages: ['line#54 failed', 'line#63 failed', 'line#100 failed'] }; -
shahzadns created this gist
Oct 14, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ // success response example - http status code - always 200 var res = { code: '200', messages: ['signup success'], data: { user: user } }; // error response example - http status code - // client-side - 400 (payload missing), 401(invalid payload), 403 (unauthorized), // server-side - 500 (internal error - script code breaks), 503 (service unavailable - server is down) var res = { code: 'ESU1', //Error Sign Up - email already exist, and similar stuff. messages: ['sign-up failed', 'email exists'] }; // upload excel file error example - or any similar stuff that can have multiple errors (other example. BE validation) var res = { code: 'ERU1', //Error Records Upload - partial success messages: ['line#54 failed', 'line#63 failed', 'line#100 failed'] };