Friday, 24 October 2014

Exploring Puma rest services WebSphere portal8.0

Puma Rest services :- Ibm has exposed Puma Spi as a rest services so that we will be able to access Puma services even the application is deployed in different server provided required authentication.

Puma rest url base portal (secure url{/um/secure} and non-secure{/um})
Puma rest url virtual portal (secure url{/wps/um/secure/vp/sales/users/profiles } and non-secure{/wps/um/vp/sales/users/profiles })

Examples :- All examples given below will download an atom file


Rest url parameters  
expandRefs
Whenever there are references included in the REST responses, they are by default included without details. This is done because the URL parameter “expandRefs” is “false” by default. If you add the parameter to your REST call using “true” then all references (e.g. users in a search request) will contain details. One example is that in a search request for all users the user's attribute values are included in the response as well. Another example is that for group membership request the group details are included in the response as well. See examples in the section “Working with membership”.
resultsPerPage
You can add this parameter to URLs if you want to page through the result. The response will contain information about total number of search results and links to first, last and next page.
sortByAttributes
If you use resultsPerPage then you can add this parameter to determine the attribute that is used for sorting the result list.
sortDescending
If you use sortByAttributes then you can add this parameter to invert the sort order from ascending to descending.
update
This parameter is to be used for update requests. It defines how the update will be done. Possible values are:
  • replace: All existing data relevant to this update will be replaced by the input. This is the default.
  • merge: The existing data relevant to this update and input data will be merged.
  • delete: The existing attributes or instances relevant to this update (depending on the area where used), that are also in the input data will be deleted. Values of the input data are ignored here. 

    Sample urls
/um/attributes/users
For the HTTP method GET:
This URI path operation returns the list of attribute definitions that are available for users. This URI path operation has the following query parameter:

Example 1:- {http://localhost:10039/wps/um/secure/attributes/users/uid } or {http://localhost:10039/wps/mycontenthandler?uri=um:secure/attributes/users/uid}

Example 2:- http://localhost:10039/wps/um/secure/attributes/users



/um/attributes/groups
For the HTTP method GET:
This URI path operation returns the list of references to the attribute definitions that are available for groups with references to the URI path operation/um/attributes/groups/attribute name. This URI path operation has the following query parameter:

Example 1 :- http://localhost:10039/wps/um/secure/attributes/groups



/um/attributes/groups/attribute name
For the HTTP method GET:
This URI path operation returns a representation of the attribute definition. For details refer to the topic about payload description. This URI path operation has no query parameter.

/um/currentuser/profile
For the HTTP method GET:
This URI path operation returns the profile of the current user. If this operation is performed without authentication, the profile of the anonymous user is returned. This URI path operation has no query parameter.

Example :- {http://localhost:10039/wps/um/secure/currentuser/profile } or {http://localhost:10039/wps/mycontenthandler?uri=um:secure/currentuser/profile}




/um/users/profiles /um/groups/profiles
For the HTTP method GET:
This URI path operation returns the list of references to all user or group profiles that correspond to the search criteria and other parameters. If there are no limiting parameters, all available users or groups are returned. The list that is returned is access control filtered for the current user. This URI path operation has the following query parameters:

Example 1 :- http://localhost:10039/wps/um/secure/users/profiles


Example 2 :-  http://localhost:10039/wps/um/secure/groups/profiles


Example 3{Encode=to %3d} :-  http://localhost:10039/wps/um/secure/users/profiles?searchAttributes=uid%3dbookadmin&resultsPerPage=2


Example 4 {includeAttributes will provide additional information}:- http://localhost:10039/wps/um/secure/users/profiles?searchAttributes=uid%3dbookadmin&resultsPerPage=2&includeAttributes=givenName,ibm-primaryEmail,sn;

/um/users/profiles/unique ID of user /um/groups/profiles/unique ID of group
For the HTTP method GET:
This URI path operation returns a representation of the user or group profile. For details refer to the topic about the payload description. This URI path operation has the following query parameter:

Example 1 :- http://localhost:10039/wps/um/secure/users/profiles?identifier=uid=wpsadmin,o=defaultWIMFileBasedRealm



/um/groupmembership/unique ID of user /um/groupmembership/unique ID of group
For the HTTP method GET:
This URI path operation returns all group profiles to which the user is a member. This is also called the membership list.


Possible error codes

400 - Bad Request
The input provided in the request body does not comply to the expected format. For example, this can be invalid XML in a posted profile.

401 - Unauthorized

Access control check during request processing failed.

403 - Forbidden

The operation that the client tries to perform is not possible. For example, this can be creating a user ID that already exists, setting attribute values for attributes that are not defined, or using mutually exclusive request parameters.

404 - Not Found

The URI does not match any of the defined URI paths or a variable part of a defined URI path does not denote a resource that exists.

405 - Method Not Allowed

The request addresses a defined URI, but uses an HTTP method that is not defined for this URI.

415 - Unsupported Media Type

The format specified in the mime-type URI parameter or accept headers is not supported. 








2 comments:

  1. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating mulesoft Online Training

    ReplyDelete

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...