Using custom client, I get now an error login with my APIkey

145 views
Skip to first unread message

Jean-Paul Godard

unread,
Feb 23, 2014, 4:18:37 AM2/23/14
to astro...@googlegroups.com
Hi all,

I'm using a Java Client (JanClient).
last successfull login was on 02/19. 
Now the server returns "no Json" at login!!

Any change on your side?

Web API Ok! ApiKey seems OK!

Jean-Paul

Dustin Lang

unread,
Feb 23, 2014, 8:39:58 AM2/23/14
to astro...@googlegroups.com
Hmm...  I updated the nova site a couple of days ago.  The python API client still works.  Could you please send a full example, showing what the client sends and what it gets back?

cheers,
--dustin


Jean-Paul Godard

unread,
Feb 24, 2014, 2:46:54 PM2/24/14
to

Thanks for your quick answer.
Attached is a log of http packets collected by "Network Monitor" 

Regards
Jean-Paul

attachment deleted

valentin_com

unread,
Feb 24, 2014, 6:33:44 AM2/24/14
to astro...@googlegroups.com
Hi,

yes. JanClient can not login. It will be sent following:

POST http://nova.astrometry.net/api/login HTTP/1.1

input.setContentType("application/json");

Entity is sent:

"request-json=" + jsonObject.toJSONString()

where jsonObject.toJSONString()  = {"apikey":"mykey"}

together it is so : request-json= {"apikey":"mykey"}

what is false?

Valentin

Dustin Lang

unread,
Feb 24, 2014, 8:44:19 AM2/24/14
to
The most recent web site update switched from Django 1.3 to 1.6, so maybe the change is in there somewhere.

I just added some debugging -- could you please try now?

I tried to run the JAN client to test for myself but I get:

> java -jar JANClient/JANClient.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: astrometry/net/client/java/JANClient : Unsupported major.minor version 51.0
[...]
> java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

thanks,
--dustin


Dustin Lang

unread,
Feb 24, 2014, 8:44:32 AM2/24/14
to
OH wait, you are sending:

Content-type: application/json ?

That is wrong.  You are sending a regular HTML form -- it MUST be

application/x-www-form-urlencoded
or
multipart/form-data

If it worked before, that was a coincidence :)

cheers,
--dustin


valentin_com

unread,
Feb 24, 2014, 9:59:03 AM2/24/14
to
Hi Dustin,

1. It is right. I have changed the context type and it is working ok.
2. The question: in Python Client I saw "text/plain" # "application/json". What does it mean?
3. In instruction we give for JanClient Java 7 and more.
4. Is it possible to publish these changing?
5. In the next post I send the final JanClient with Context-Type "application / x-www-form-urlencoded"
Could You give me the place to check-in the Client?

Best regards

Valentin

PS
RFS 4627 -> The MIME media type for JSON text is application/json.

valentin_com

unread,
Feb 24, 2014, 9:40:04 AM2/24/14
to astro...@googlegroups.com
Hi Jean,

I have changed the content-type. I works ok.
I send the new final V1.01 version now.

best regards

Valentin
JANClient.zip
INSTALL.txt

Dustin Lang

unread,
Feb 24, 2014, 9:45:34 AM2/24/14
to astro...@googlegroups.com

Excellent, thank you!

I have posted it here:
  http://astrometry.net/downloads/contrib/JANClient/

cheers,
--dustin

valentin_com

unread,
Feb 24, 2014, 10:01:06 AM2/24/14
to astro...@googlegroups.com
Many thanks, Dustin

Dustin Lang

unread,
Feb 25, 2014, 5:29:11 PM2/25/14
to astro...@googlegroups.com
Hi,


> 2. The question: in Python Client I saw "text/plain" # "application/json". What does it mean?

"#" starts a comment in python, so that means I first wrote "application/json" and then realized that that was wrong and changed it to "text/plain", but left the old value there in a comment because sometimes I forget to delete old code :)


RFS 4627 -> The MIME media type for JSON text is application/json.

Yes, but this is not application/json, it's JSON as part of an x-www-form-encoded message (JSON value with the key "request-json").  True, I could have made the API so that the POST accepts plain JSON (removing the "request-json=" part) instead of something that looks like an HTML form, and in that case it would be appropriate for it to be application/json.  But I thought it was nice for it to look like an HTML form.  Maybe I was wrong.

cheers,
--dustin


Reply all
Reply to author
Forward
0 new messages