API Documentation

Model

Info Get

Returns the model information for the specified model id.

GET /api/info/<int:modelid>
GET /api/info/<int:modelid>/<int:revision>

Sample (prettified) Response:

{
	"id": 423,
	"title": "Eiffel Tower",
	"lat": 48.8583,
	"lon": 2.2945,
	"desc": "A model of the world famous Eiffel Tower",
	"tags": {
		"shape": "pyramidal",
		"building": "yes",
		"tourism": "attraction",
	}
	"author": "n42k",
	"date": "2017-03-28",
	"categories": ["monuments", "tall"],
	"comments": [
	{
		"author": "n42k",
		"body": "I've technically been here!"
	},
	{
		"author": "n42k",
		"body": "test comment"
	}
	]
}

Model Get

Returns a zip with the model of the specified model id.

GET /api/model/<int:modelid>
GET /api/model/<int:modelid>/<int:revision>

Sample Response: a zip file.

File List

Returns a listing of all the files present in the model zip.

GET /api/filelist/<int:modelid>
GET /api/filelist/<int:modelid>/<int:revision>

Sample Response:

EiffelTowerLarge_copy.png
EiffelTowerLarge_copy_0.png
eiffel.mtl
eiffel.obj
et.jpg

File

Returns a file from the model zip.

GET /api/filelatest/<int:modelid>/<string:filename>
GET /api/file/<int:modelid>/<int:revision>/<string:filename>

Sample Response: a file.

Lookups

Tag Lookup

Returns model ids that have the specified tag as one of their tags.

GET /api/tag/<string:tag>
GET /api/tag/<string:tag>/<int:pageid>

Sample Response:

[3, 5]

Category Lookup

Returns model ids that have the specified category as one of their categories.

GET /api/category/<string:tag>
GET /api/category/<string:tag>/<int:pageid>

Sample Response:

[6, 8]

Author Lookup

Returns model ids that have the specified author as one of their categories.

GET /api/author/<string:username>
GET /api/author/<string:username>/<int:pageid>

Sample Response:

[6, 8]

Searches

Title Search

Returns model ids that contain the specified string in their title.

GET /api/search/title/<string:title>
GET /api/search/title/<string:title>/<int:pageid>

Sample Response:

[2, 10, 17]

Latitude and Longitude Search

Returns model ids that have the specified category as one of their categories.

GET /api/search/<float:lat>/<float:lon>/<float:range>
GET /api/search/<float:lat>/<float:lon>/<float:range>/<int:pageid>

Sample Response:

[2, 10, 17]

Full Search

Permits combining various criteria to find the exact kinds of models we need. Search query is sent in the request body. If any parameter is not specified, it's ignored and won't be filtered from the results.

Notes:

  • The "lat", "lon" and "range" attributes do what is described in the Latitude and Longitude Search endpoint.
  • The "title" attribute does what is described in the Title Search endpoint.
  • The "tags" attribute finds models that match all tags.
  • The "categories" attribute finds models that match all categories.
  • The "author" attribute does what is described in the Author Lookup endpoint.
  • Only models that match all attributes are returned
  • The "format" attribute allows you to retrieve more than the model id, allowing quick access to the location and title of many models around a point, for example.
POST /api/search/full

Live request body (try pressing Submit!):


Response:

(None yet)

Sample request body:

{
"lat": 48.8583,
"lon": 2.2945,
"range": 1000,
"title": "Eiffel",
"tags": {
"shape": "pyramidal",
"building": "yes"
},
"categories": [
"monuments",
"tall"
],
"page": 1,
"author": "n42k"
}

Sample Response:

[6, 8]

Sample request body with format attribute:

{
"lat": 48.8583,
"lon": 2.2945,
"range": 1000,
"format": ["id", "latitude", "longitude", "title"]
}

Sample Response:

[[1, 48.8583, 2.2945, "Eiffel Tower"], [64, 48.85831, 2.2945, "Near Eiffel Tower"]]