Get original filename from API

119 views
Skip to first unread message

Stijn

unread,
May 15, 2013, 3:10:30 AM5/15/13
to astro...@googlegroups.com
Hello all,

First of all, I am new to working with API. I uploaded 100+ fits files for which I need the wcs-coordinates. Using the client.py file, I am able to get info on specific jobs. When trying to access the /api/jobs/ folder, to get a list of all my jobs, I get the following error:

HTTPError HTTP Error 403: FORBIDDEN

Is it in any way possible to get a list of all my jobs through the API?

My next question concerns extracting the original name of the uploaded file. Once the image is successfully identified, I only want to download the new header and add it to the original file fits header. It is listed in the details tab for each image, but the API cannot access /api/jobs/job_id/details/.

Lastly, I was wondering how I would be able to get a list of all services which can be accessed through the API. Unless all accessible services are already listed in the client.py file, ofcourse.

Thanks in advance,

Kind regards,

Stijn Debackere
err.html

Dustin Lang

unread,
May 15, 2013, 9:41:22 AM5/15/13
to astro...@googlegroups.com
Hi,

All the API calls are exercised by the client.py code -- that's how I test the API.  You can also check the URL schema:

http://trac.astrometry.net/browser/trunk/src/astrometry/net/urls.py

and search for "api/"

An API call to get your list of jobs is a good idea but not currently implemented.

You could try a work-around: call /api/jobs_by_tag?query=

ie, a blank search.  That *may* return all your jobs.

You can, by the way, peruse the server-side API code here:
  http://trac.astrometry.net/browser/trunk/src/astrometry/net/api.py

Also note that some of the result files are available through regular URLs (no /api/), eg, you can get the WCS header file at nova.astrometry.net/wcs_file/JOB_ID
so not everything is necessarily exposed via the API.

Keep those API requests coming!

cheers,
dustin

Stijn

unread,
May 15, 2013, 10:13:30 AM5/15/13
to astro...@googlegroups.com
Hey,

Thanks for the answer. So I deduce that is not (yet?) possible to also return the name of the file I uploaded from the job information? I knew about the /wcs_file/job_id, but the problem is attaching the header to my original file...

Any ideas on implementing a rudimentary solution?

I tried the empty query, but it kept returning internal server errors.

Thanks again,

Kind regards,

Stijn Debackere

Dustin Lang

unread,
May 15, 2013, 12:51:28 PM5/15/13
to astro...@googlegroups.com

I added two new API calls in our testing area:
   http://staging.astrometry.net/
(note that your API key there will be different than on nova)

/api/myjobs  -- returns your list of job ids.
/api/jobs/JOB_ID/info   -- returns a bunch of info, including original_filename.

Please let us know how that works, or of any problems you see.

cheers,
dustin

Stijn

unread,
May 15, 2013, 2:20:21 PM5/15/13
to astro...@googlegroups.com
Thank you! It is much appreciated. One thing, when trying to upload files to the staging server, I get the following error:

...ile "process_submissions.py", line 337, in try_dosub
    return dosub(sub)
  File "process_submissions.py", line 366, in dosub
    sub.set_processing_really_started()
AttributeError: 'Submission' object has no attribute 'set_processing_really_started'

Also, I think the code for /api/myjobs should be changed slightly:

def myjobs(self):
    result = self.send_request('myjobs', {})
    return result['jobs']

Since I cannot yet upload items, I don't know whether this works, but looking at the other requests I think it should.

Thanks again,

Kind regards,

Stijn Debackere


Dustin Lang

unread,
May 15, 2013, 2:31:49 PM5/15/13
to astro...@googlegroups.com
Staging should have access to your nova submissions, no?


> Also, I think the code for /api/myjobs should be changed slightly:
>
> def myjobs(self):
>     result = self.send_request('myjobs', {})
>     return result['jobs']

I updated the send_request() function to have a default for the args, so the
"{}" is no longer required.

I just fixed the set_processing_really_started() bug -- oops, thanks for your
note -- so give it a shot now.

Stijn

unread,
May 15, 2013, 3:06:30 PM5/15/13
to
As I said, I am new to the concept so I don't know whether it can. I use the same google account, but on staging it doesn't show any images. How could I get my nova images there?

When uploading now, I don't get an error, however, in the my submissions tag every submission states "no jobs".

Kind regards,

Stijn Debackere

EDIT: Now uploading on staging works, myjobs/ works aswell, as does the info API!
Thanks a bunch!


Dustin Lang

unread,
May 15, 2013, 3:05:10 PM5/15/13
to astro...@googlegroups.com
Oops, I forgot to restart the server-side process that runs incoming jobs -- try now.

'staging' is supposed to be able to see all your nova jobs, but during my testing I was finding some strange behavior -- it looked like it was creating a new user account for me instead of using my existing one, so it was telling me the wrong API key.  Afraid I don't have time to look into this right now though...

--dstn

Stijn

unread,
May 15, 2013, 3:09:05 PM5/15/13
to astro...@googlegroups.com
As edited in previous post, it worked for me.

I noticed the same on staging, it created a new user account, my original one was 1989, now I am 1996.

I am already quite happy with the adjustments you've made thus far :)

Kind regards,

Stijn Debackere

Stijn

unread,
May 15, 2013, 3:12:22 PM5/15/13
to astro...@googlegroups.com
OK, when using my original api, I can now access everything I want on staging. Thanks a lot!

Kind regards,

Stijn Debackere

Stijn

unread,
May 21, 2013, 12:06:10 PM5/21/13
to astro...@googlegroups.com
Hey,

I uploaded some new files to nova, but staging does not seem to update. I have already waited for some days, but it still does not show my latest jobs. Does it take a while to synchronize the api? All new features seem to work fine on staging, would it be possible to get them on nova? Or is there a certain procedure involved before adding new features to nova?

Thanks in advance,

Kinds regards,

Stijn Debackere

Dustin Lang

unread,
May 24, 2013, 1:55:43 PM5/24/13
to astro...@googlegroups.com
Hi,

Ahh, yes, staging just gets a *snapshot* of nova's jobs whenever I update it; it doesn't track new jobs submitted to nova.

I just updated the nova site to pull in the changes that were being tested out on staging.

Thanks for your patience...

--dustin
Reply all
Reply to author
Forward
0 new messages