RESTful Access to Identity Server (version beta 4.1)IntroductionIntroductionThe Identity Server provides REST services for
Nearly all services require a login as a security measure; user registration and password reset are two that do not. Most services use the logged-in user to associate or limit access to the serviceable entity. For example a created user profile will be associated with the logged-in user, implicitly. Client RequirementsThe IdentityServer REST interface is accessed using HTTPS POST, GET, PUT, and DELETE. JSON is used to pass application data to and from the server, with a few exceptions as indicated below by the HTTP request header requirements.
The REST calls that need a user login will require the HTTP header General REST Implementation DetailsThe URLs below need to be prefixed with an appropriate GenomeSpace Identity Server URL, which is obtained at runtime as described in the Adopters page. An example is https://identity.genomespace.org/identityServer/. REST failure responses indicating generic errors are not shown. Examples are 405 for Incorrect HTTP verb, 401 for Not logged in, 409 for Internal server error including incorrectly formatted json, and 403 for operations forbidden due to access restriction, such as deleting another user's user profile.
In general it is desirable (but optional) for tools to add a header (or request parameter, or cookie, any of these forms can be used) User ServicesRegistration RequestCreates a request for GenomeSpace user account. An email is sent to the user containing a url. Account registration is completed when an HTTP GET is done on that url. Please note, the previous single-step registration is deprecated, and will become unusable in the near future. A login is not required. Username and password are validated (40 chars max, restricted char set, and username uniqueness) and a 409 status with message is returned if there is a problem. RequestAll JSON fields shown here are required. Required headers: Accept: text/html, Content-Type: application/json
Response
Registration CompletionFinalizes a registration request. The uuid parameter comes from an email that was sent to the user. A login is not required. RequestRequired headers: none
Response
Reset PasswordThe GenomeSpace server will assign a time-limited, one-use temporary password to the user, and will email it to the email address on record for that user. The regular password is not changed by this action; user can change their password once logged in with the temporary password. RequestRequired headers: none {username_or_email} is either the GenomeSpace username, or the registered user's email address.
Response
Get Remaining Time on TokenGenomeSpace generates a string upon successful login called a token, and it is typically put in a cookie or in ~/.gs. This service returns the amount of time remaining on a token. The token to be examined may come from either a cookie or URL query parameter. No user login is necessary. RequestRequired headers: Accept: text/plain
Response
Get Username from TokenA given token (a GenomeSpace generated string) is assigned to a user. This service returns the username for a token. The token to be examined may come from either a cookie or URL query parameter. No user login is necessary. RequestRequired headers: Accept: text/plain
Response
Get All GenomeSpace UsernamesReturns all GenomeSpace usernames. A login is required for security but does not affect the results. RequestRequired headers: Accept: application/json
Response
Find matching GenomeSpace Usernames by EmailReturns all GenomeSpace usernames matching the email provided. A login is required for security but does not affect the results. RequestRequired headers: Accept: application/json
Response
Get User InfoReturns the logged-in user's registration info. RequestRequired headers: Accept: application/json
Response
Change Email or PasswordAllows a GenomeSpace user to change his/her password or email address. A user login is required. RequestRequired headers: Content-Type: application/json JSON should contain only the fields that change, i.e. only password, only email, or both.
Response
Delete User RecordAllows a GenomeSpace user to delete his/her GenomeSpace account. A user login is required. RequestRequired headers: none
Response
Get User Action Log (history)Get the user action log entries for the current user over a specified time period. Requires user be logged in. RequestRequired headers: Accept: application/json. Dates should be formatetd as "yyyy-mm-dd" (e.g. '2013-08-12' for August 12, 2013)
Response
User Profile ServicesUser Profiles are per-user persistent data kept as database records. A user profile has an internal UUID but is functionally identified by client-defined optional attributes. A client should always define one attribute called "module" which serves as a namespace, having the value of the Java package, or client's url domain name. Create User ProfileCreates an instance of user profile. Requires a GenomeSpace login, and the username json parameter must match the login (404 results otherwise). The HTTP reply will contain the url of the created resource. The 36 character UUID profile id is the last component in the created URL. RequestRequired headers: Content-Type: application/json
Response
Get User Profile by UserGets all profiles for a user, or applies filtering to get only some. Optional attributes specify which subset of profiles should be fetched. If no optional attributes are specified then all the user's profiles are returned. If one or more are specified then only profiles having a matching optional attribute are returned. RequestRequired headers: Accept: application/json
Response
Get User Profiles by UserGets the one specified profile, or returns 404 if profile not found. RequestRequired headers: Accept: application/json
Response
Update User ProfileChanges an existing user profile record. Update permits the removal of optional attributes. All optional attributes to be kept must be provided in the update json, along with the UUID. To change just the persisted value, an alternative is to "re-create" a user profile using POST and specifying exactly the same optional attributes, and that will overwrite an existing profile. RequestRequired headers: Content-Type: application/json
Response
Delete User ProfileRequestRequired headers: none
Response
Group Management ServiceGet All Group Names and Group IdsReturns all group names and their ids. A login is required for security but does not affect the results. RequestRequired headers: Accept: application/json
Responses
Get Group Ids for UserReturns the groupId of all groups whose membership includes the specified user. A login is required for security but does not affect the results. RequestRequired headers: Accept: application/json
Response
Create GroupCreates a group. If no members are specified, adds the logged-in user as the first member and first group administrator. If members are specified, at least one must be flagged as the administrator. The HTTP reply will contain the url of the created resource. The 36-character UUID groupId is the last component in the created URL. RequestRequired headers: Content-Type: application/json
Response
Get groupReturns the attributes of the group. Will also return membership if the logged-in user is a member of the group, or if the group is non-member readable. Otherwise the membership will be empty. RequestRequired headers: Accept: application/json
{groupid} is the UUID generated when the group was created. Response
Get groups for UserReturns the group attributes (no membership info) of all groups whose membership includes the user. A login is required for security but does not affect the results. RequestRequired headers: Accept: application/json
ResponseThe return datatype is JSON.
Get my readable groupsReturns the group attributes (no membership info) of either groups whose membership includes the logged-in user, or groups that are non-member readable. Login is required and it determines the membership username that gets used. RequestRequired headers: Accept: application/json
ResponseThe return datatype is JSON. In the following example the logged in user is a member of group0 and gs-public, but not of group1.
Get my manageable groupsReturns the group attributes (no membership info) of either groups whose administrators includes the logged-in user, or groups that are self-administrating and whose membership includes the logged-in user. Login is required and it determines the membership username that gets used. RequestRequired headers: Accept: application/json
ResponseThe return datatype is JSON. In the following example the logged in user is an admin of group0, and only a member of the self-administered group1.
Update groupUpdates the attributes of a group. If members are specified then the membership is updated too, provided at least one member remains and at least one administrator. The logged-in user must be an administrator of the group. A self-administered group allows non-administrators to update membership but not the group attributes. RequestRequired headers: Content-Type: application/json
Response
Delete groupDeletes the group. The logged-in user must be an administrator of the group. RequestRequired headers: none
Response
|