Manage Users and Authentication

Get List of Users

Method Path Description
GET baseurl/users Return a list of users given a filter.

Request Parameters

Parameter Value Description
q String Filter expression to use to search against the WindyGrid user repository. Pass {}(empty object) to specify ‘no filter’ or leave out this parameter altogether.
The query filter must follow the MongoDB query syntax, as with all other API calls that has a query filter parameter. It is recommended that this value be URL encoded.
n String The maximum number of records to return; If this parameter is not specified, no records are returned (i.e. default value of 0).

Sample Request

https://webapps1.chicago.gov/windygridservice/rest/users?q={}&n=1000
Or when URL encoded:

https://webapps1.chicago.gov/windygridservice/rest/users?q=%7B%7D&n=1000

Sample Response

[{
    "_id":
       {"$oid":"55ca20b9c4aac050466bc1a3"}, 
  "userId":"tester1",
  "password":"password1",
  "firstName":"Tester",
  "lastName":"One",
  "groups":["windygridbasic"]
 }]

Return User Information

Method Path Description
GET baseurl/users/{user_id} Return a single user object given the user’s internal id.

Sample Request

https://webapps1.chicago.gov/windygridservice/rest/users/{"$oid":"55b63708a3db5f292c533c7b"} 

or when URL encoded:

https://webapps1.chicago.gov/windygridservice/rest/users/%7B%22%24oid%22%3A%20%2255b63708a3db5f292c533c7b%22%7D

Sample Response

    {
      "_id":{"$oid":"55b63708a3db5f292c533c7b"},
      "userId":"TesterOne",
      "password":"test123",
      "firstName":"ABC Test",
      "lastName":"One Update",
      "groups":["windygridbasic"]
        }

Add Users

Method Path Description
POST baseurl/users Creates a new user. Returns object for newly created user, if successful.

Sample Request

     {
       "id": null,
       "o":{"userId":"test3",
            "password":"testxxx",
            "firstName":"Test",
            "lastName":"Three",
            "groups":[]
                }
            }

Sample Response

    {
      "userId":"test3",
      "password":"testxxx",
      "firstName":"Test",
      "lastName":"Three",
      "groups":[ ],
      "_id":{"$oid":"55ca52dec4aac050466bc1a9"}
        }

Update User Information

Method Path Description
PUT baseurl/users/{user_id} Update user information; returns the updated user data, if successful.

Sample Request

https://webapps1.chicago.gov/windygridservice/rest/users/{"$oid":"55ccaca15fc6c6bf8a807cf2"}

or when URL encoded:

https://webapps1.chicago.gov/windygridservice/rest/users/%7B%22$oid%22:%2255ccaca15fc6c6bf8a807cf2%22%7D

Request Payload

    {
      "id":{"$oid":"55ccaca15fc6c6bf8a807cf2"},
       "o":{"_id":{"$oid":"55ccaca15fc6c6bf8a807cf2"},
            "userId":"testUser",
            "password":"testxxx",
            "firstName":"Test",
            "lastName":"User",
            "groups":["windygridfullreal",
                      "windygridbasic"]
            }
         }

Sample Response

   {
      "userId":"test3",
      "password":"testxxx",
      "firstName":"Test",
      "lastName":"User",
      "groups":[ ]
     }  

Delete User

Method Path Description
DELETE baseurl/users/{user_id} Delete a user given the user’s internal Id on the URL path.

Sample Request

https://webapps1.chicago.gov/windygridservice/rest/users/{"$oid":"55b63708a3db5f292c533c7b"}

or when URL encoded:

https://webapps1.chicago.gov/windygridservice/rest/users/%7B%22%24oid%22%3A%20%2255b63708a3db5f292c533c7b%22%7D

Sample Response

No response is returned when a user is deleted successfully.