cannot call rest

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

cannot call rest

#1

Postby Steve James » Thu Feb 16, 2017 10:29 am

This might be a simple question but here goes anyway.

I'm trying to process the result of a rest call. I've got our proxy configured but I keep getting connection refused errors.

For example

Code: Select all

var url = 'https://datamillnorth.org/api/3/action/organization_list';

var response = services.rest.get(url);
This works fine in Chrome Postman extension.

I've tried adding the Authorization header and my API key with the same error but I don't believe I need the key for this simple get.

Code: Select all

Wrapped com.ebasetech.xi.exceptions.RestRuntimeException: Error performing request: Connect to datamillnorth.org:443 [datamillnorth.org/54.217.219.130, datamillnorth.org/54.247.112.208, datamillnorth.org/176.34.114.107] failed: Connection refused: connect (DMNReview#8)
Any ideas?
Thanks
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Thu Feb 16, 2017 11:11 am

This works fine on my system.
I guess this implies that it's something to do with the proxying.
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#3

Postby Steve James » Thu Feb 16, 2017 1:42 pm

Thanks Jon, hmm still no joy. I've got it working using java.net openConnection.

I'm losing my mind with US dates though. I thought the place to format dates was languages.
Both Date Literal format and my default language (EN) are showing dd/mm/yyyy but

Code: Select all

var dd = new Date('16/02/2017');
var fd = services.date.formatDate(dd, 'dd MMM yyyy');
fd shows as 02 APR 2018.
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#4

Postby Steve James » Thu Feb 16, 2017 2:06 pm

ahhh sorted using SimpleDateFormat and parse....

I'm sure it used to work.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#5

Postby Jon » Thu Feb 16, 2017 2:25 pm

or you can use:
new Date(2017, 2, 16)
or just
new Date()
if you want the current date.

I think the string constructor is yyyy/mm/dd e.g.
new Date("2017/02/16");
but not sure about this.
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#6

Postby Steve James » Thu Feb 16, 2017 3:06 pm

Yes thanks. I converted the string to a date with month by name and it worked. It looks like Date(String s) has been deprecated.

If anyone else is interested then...

Code: Select all

var dStr = '16/02/2017';
var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
var ThisDateWorks = sdf.parse(dStr);
0 x


Who is online

Users browsing this forum: No registered users and 72 guests