Skip to content

Instantly share code, notes, and snippets.

@krazylearner
Created October 21, 2016 11:27
Show Gist options
  • Save krazylearner/0ccf3dba93d4f1a29c1f94a834a008da to your computer and use it in GitHub Desktop.
Save krazylearner/0ccf3dba93d4f1a29c1f94a834a008da to your computer and use it in GitHub Desktop.

Show User

Returns json data about a single user.

  • URL

    /users/:id

  • Method:

    GET

  • URL Params

    Required:

    id=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: { id : 12, name : "Michael Bloom" }
  • Error Response:

    • Code: 404 NOT FOUND
      Content: { error : "User doesn't exist" }

    OR

    • Code: 401 UNAUTHORIZED
      Content: { error : "You are unauthorized to make this request." }
  • Sample Call:

      $.ajax({
        url: "/users/1",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment