This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 1, 2012, 11:12 PM
24 Posts

Call HTTP API from button and parse return data

  • Category: APIs
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 1
I am trying to use an existing HTTP API to grab some user information.  The HTTP URL that I have works great.
 
I am trying to understand how I would use this inside of a button on XPages -- what I mean is that I am not sure what to use -- Link, Button, etc. -- to call this inside the code and parse the return information which will populate fields on the document.
 
I have looked at the Name Picker in the Extension Library, but I am not sure if this will work.  It seems (since I am still learning XPages) that I am limited to SSJS on a button.  I have never used JavaScript with an API, so I am not sure how to handle.
 
It would be something like this:
1. Open the URL (http://www.myAPI.com/thisAPI?ID=1234)
2. Grab what is displayed (since this opens a web page which is not what I want to do) inside the code
3. Parse the info
4. Populate the fields on the document
 
Any examples, links, etc. would be a great help -- thanks!
May 2, 2012, 5:43 AM
54 Posts
Re: Call HTTP API from button and parse return data
There's an excellent open source Java library Apache HTTP Client which does the trick (as far as I understood your question). It's easy to use.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal