MapAPI

clemty edited this page Nov 3, 2015 · 16 revisions

Map API

Download map using its Hash:

http://resource.openra.net/map/MAPHASH

where MAPHASH is a hash uid for requested map.
Map will be served with Content-Disposition header and name will look like: mapname-revisionid.oramap.
If map with specified hash is not found, 404 error is served.

Get map info by title:

http://resource.openra.net/map/title/MAPTITLE

where MAPTITLE is a part of map's title for requested map.
You must be more exact to find map you need.
As a result of request, you will get a JSON page with basic map information.
If map with specified title is not found, 404 error is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.

Get map info by hash:

http://resource.openra.net/map/hash/MAPHASH[,MAPHASH1,MAPHASHn]

where MAPHASH is a hash uid for requested map.
As a result of request, you will get a JSON page with basic map information.
If map with specified hash is not found, 404 error is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.

Get map info by ID:

http://resource.openra.net/map/id/MAP_ID[,MAP_ID1,MAP_IDn]

where MAP_ID is an ID for requested map.
As a result of request, you will get a JSON page with basic map information.
If map with specified ID is not found, 404 error is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.

Get map url by hash

http://resource.openra.net/map/url/MAPHASH

where MAPHASH is a hash uid for requested map.
AS a result of request, you will get a JSON page containing map's url and some additional info you might need.
If map with specified hash is not found, 404 error is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.

Get minimap by hash:

http://resource.openra.net/map/minimap/MAPHASH

where MAPHASH is a hash uid for requested map.
As a result of request, you will get a JSON page containing bytes of minimap for requested map encoded using base64 encoding; there will be some additional info you might need.
To get a minimap image, you have to decode provided base64 string and dump received bytes into file.
If map with specified hash is not found, 404 error is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.

Get info of the newest map:

http://resource.openra.net/map/lastmap/

As a result of request, you will get a JSON page with basic map information.
If /yaml/ prefix is added in the end of URL, YAML page will be served.


Get a filtered list of maps:

note: this list includes basic map information with url and minimap for it.

Simple list for mod:

http://resource.openra.net/map/list/MOD

where MOD is a mod name (ra,d2k,cnc, etc.).
As a result of request, you will get a JSON page for 1 or more maps.
If mod is invalid, 404 error is served.

Change order of result items:

http://resource.openra.net/map/list/MOD/ORDER

where MOD is a mod name (ra,d2k,cnc, etc.) and ORDER is one of: players,-players,posted,-posted,rating,-rating,downloaded,-downloaded,title,-title,author_name,-author_name.

players: sort by map slots, descending
posted: sort by date of publishing, descending
rating: sort by rating for map, descending
downloaded: sort by amount of downloads, descending
title: sort by map name, in alphabetical order
author_name: sort by author name, in alphabetical order

Adding "-" char at the beginning of filter name, will reverse order.
If mod is invalid, 404 error is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.

Show maps made by some author:

http://resource.openra.net/map/list/MOD/author/AUTHORNAME

where MOD is a mod name (ra,d2k,cnc, etc.) and AUTHORNAME is a name of author for maps.
As a result of request, you will get a JSON page for 1 or more maps made by specified author.
If mod is invalid, 404 error is served; If author is not found, empty JSON list is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.

Show maps uploaded by some person:

http://resource.openra.net/map/list/MOD/uploader/UPLOADERNAME

where MOD is a mod name (ra,d2k,cnc, etc.) and UPLOADERNAME is a name of person who uploaded maps you want to see.
As a result of request, you will get a JSON page for 1 or more maps uploaded by specified person.
If mod is invalid, 404 error is served; If uploader is not found, empty JSON list is served.
If /yaml/ prefix is added in the end of URL, YAML page will be served.


Get a filtered list of maps in simple format for dedicated servers usage:

http://resource.openra.net/map/sync/MOD

where MOD is a mod name (ra,d2k,cnc, etc.).
AS a result of request, you will get a simple page downloaded with filename equal to MOD containing a list of map urls separated by new line.
Only 'good' maps appear in that list and only the latest revision of a particular map.
Note that dedicated server admins do not actually need to use this API as there is a trigger on website itself which uses it and dumps symlinks to maps into RSYNC directory, which is more comfortable to manage (see docs).
If list of url's is empty, 404 error is served (unknown mod or no maps allowed for downloading).

Get a list of ALL maps (including all revisions and maps which are not suitable for playing) in simple format:

http://resource.openra.net/map/syncall/MOD

where MOD is a mod name (ra,d2k,cnc, etc.).
AS a result of request, you will get a simple page downloaded with filename equal to MOD containing a list of ALL map urls (even broken and not suitable for playing) separated by new line.
If list of url's is empty, 404 error is served (unknown mod or no maps found).