Oct 22, 2015, 12:13 PM
1 Posts

external REST JSON service connection

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: REST,JSON
  • Replies: 1

Hi all, former developer would appreciate any suggestions on a good way to go about connecting to an external db that offers a REST service to bring back the data to notes.  I have not had luck searching for external REST connections that are not xml.

specifically my data returned from the URL query looks like this:

{
 "displayFieldName": "name",
 "fieldAliases": {
  "name": "name"
 },
 "fields": [
  {
   "name": "name",
   "type": "esriFieldTypeString",
   "alias": "name",
   "length": 200
  }
 ],
 "features": [
  {
   "attributes": {
    "name": "SI5006_COLLIE"
   }
  },
  {
   "attributes": {
    "name": "SI5007_DUMBLEYUNG"
   }
  },

etc...

Would like to use xpages something like what Brad did on his blog at xcellerant (but am open to anything that will work of course!)

<xe:restService id="restJsonService" pathInfo="gridData">
  <xe:this.service>
    <xe:viewJsonService defaultColumns="true" viewName="ByName-First" var="dataRow">
    </xe:viewJsonService>
  </xe:this.service>
</xe:restService>

 

Any suggestions on connecting to an external db?  I got the xpages ext lib book, but couldn't find an example of an external connection.  Thanks for reading!

Nov 6, 2015, 10:58 PM
14 Posts
Call the URL

If you're already getting a return, you can use the toJson/fromJson from here http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/Work_with_ServerSide_JavaScript

If you want to call a REST service, you don't need the REST control. You can just call the URL like here (which shows SSJS and a bean way) http://www-10.lotus.com/ldd/xpagesforum.nsf/xpTopicThread.xsp?documentId=723FF6DB19FF6ED5852579710068F37F#55F5A2FAD0687A4F8525797300779B36

The URL may need an ID and password, so like this:

http://userID:pswrd@svrName.com/database/whateverfullurl

Does that help?

Brian