AstroBin's read-only API
In short
AstroBin implements a basic set of RESTful APIs. Currently, the APIs are read-only, and they allow you to get data about images, and perform some basic searches.
Using AstroBin's API, you will be able to create your own website, desktop application, or mobile app that can use some content from AstroBin.
Some possibilities:
A web widget that displays the recent images of a certain user.
A web widget that displays the Image of the day.
An iPhone/Android for browsing AstroBin effectively.
... and many more!
Availability and limitations
AstroBin's APIs currently are limited to retrieving basic information and perform simple searches on images.
The supported response types are XML and JSON.
How to get started
The first thing you will need is an API Key. Please use the API Key request form to get one.
How to display images
The API response will provide you with several url_* properties, each one representing a different image size.
Fair use
Using the APIs to mercilessly scrape all the available content is not allowed. Failure to respect this requirement will result in the permanent revocation of one's API Key.
Please read the API section in the Terms of Service.
Some examples
Please note: all examples omit the base URL, the authentication parameters, and the format parameter. You must remember to include them in real usage, e.g.:
https://www.astrobin.com/api/v1/.../?...&api_key=...&api_secret=...&format=json
Remember that you can combine most of these queries, so feel free to experiment!
Get a single image by ID:
image/1234/
Search by subject:
image/?subjects=M31
# Note: search by subjects is limited to 100 results for performance reasons.
Search by user:
image/?user=siovene
Search by case-insensitive, partial title:
image/?title__icontains=andromeda
Search by case-insensitive, partial description:
image/?description__icontains=wind
Other useful partial tricks:
__startswith=
__endswith=
__contains=
__istartswith=
__iendswith=
Search by upload date range:
image/?uploaded__gte=2012-04-10%200:00:00&uploaded__lt=2012-04-11%200:00:00
Comparison operators:
__lt=
__lte=
__gt=
__gte=
Get today's Image Of The Day:
imageoftheday/?limit=1
Get yesterday's Image Of The Day:
imageoftheday/?limit=1&offset=1
Get the Top Picks:
toppick/
Get the Top Pick nominations:
toppicknomination/
Get a user by ID:
userprofile/1234
Get a user by username:
userprofile/?username=siovene
Community libraries
Android: AstroBinAPI by Gary Gause
PHP: Astrobin-WebServices by Stéphane Méaudre
Community apps & widgets
Android
AstroBin for Muzei, a plugin for the Muzei app to get the Image of the Day as a wallpaper, by Jacek Beny.
AstroBasket, an unofficial Android app to browse the Image of the Day, Top Picks, Top Pick nominations, and with AstroBin search functionalities.
WordPress:
AstrobinIOTDWidget and AstrobinLastImageUser by Enol Matilla.