Skip to content

Latest commit

 

History

History
234 lines (161 loc) · 8.32 KB

API.md

File metadata and controls

234 lines (161 loc) · 8.32 KB

API

v1

The v1 API has the following request form:

https://smmdb.ddns.net/api/request?querystring

Authorization

Authorization is done via API-key. Any request that requires authorization needs a header containing the following information:

'Authorization': 'APIKEY <apikey>'

Receive server statistics

Request: getstats

Method: GET

Querystring: empty

Example: https://smmdb.ddns.net/api/getstats

Receive course list

Request: getcourses || getcourses64

Method: GET

Authorization: Optional

Querystring: (default values are italic)

Query Value Description
format json | ini Order direction of courses
order lastmodified | uploaded | title | stars Order of courses
dir asc | desc Order direction of courses
limit {number} | 120 Limit maximum amount of sent courses (max: 100)
start {number} | 0 Start index for pagination
random 0 | 1 Receive random courses wrt filters
filter {Array<string>} delimited with comma Limit response values attributes, e.g. filter=id,stars
ids {Array<string>} delimited with comma Return only courses with specific id
lastmodifiedfrom {number} Unix timestamp lower limit for lastmodified value
lastmodifiedto {number} Unix timestamp upper limit for lastmodified value
uploadedfrom {number} Unix timestamp lower limit for uploaded value
uploadedto {number} Unix timestamp upper limit for uploaded value
difficultyfrom {number} Difficulty setting lower limit (0: Easy, 1: Normal, 2: Expert, 3: Super Expert)
difficultyto {number} Difficulty setting upper limit (0: Easy, 1: Normal, 2: Expert, 3: Super Expert)
title {string} Title's substring, case-insensitive
maker {string} Maker's exact name, case-insensitive
uploader {string} Uploader's exact name, case-insensitive
gamestyle {number} Game style of course (0: SMB, 1: SMB3, 2: SMW, 3: NSMBU)
coursetheme {number} Course theme (0: Ground, 1: Underground, 2: Castle, 3: Airship, 4: Underwater, 5: Ghost House)
coursethemesub {number} Subcourse theme (0: Ground, 1: Underground, 2: Castle, 3: Airship, 4: Underwater, 5: Ghost House)
timefrom {number} Course completion time lower limit in seconds
timeto {number} Course completion time upper limit in seconds
autoscroll {number} | 0 Auto scroll speed (0: disabled, 1: slow, 2: medium, 3: fast)
autoscrollsub {number} | 0 Auto scroll speed of sub course
widthfrom {number} Course width lower limit in block
widthto {number} Course width upper limit in block
widthsubfrom {number} Subcourse width lower limit in block
widthsubto {number} Subcourse width upper limit in block
prettify 0 | 1 Pretty print json response

Example: https://smmdb.ddns.net/api/getcourses?limit=50&start=121&prettify=1

Receive courses 121 to 170 in lastmodified descending order with indentation.

Response: Array<Course> || Array<Course64> where

Course:

Attribute Value Description
id {string} Unique course ID
[header.type] {number} Header type
[header.data] {string} Base64 encoded 0xF0 original course data header
owner {string} Unique owner ID
title {string} Course title
maker {string} Course maker name
gameStyle {string} Game style
courseTheme {string} Course theme
courseThemeSub {string} Course theme sub world
time {string} Completion time
autoScroll {string} Auto scroll
autoScrollSub {string} Auto scroll sub world
width {string} Course width in blocks
widthSub {string} Subcourse width in blocks
nintendoid {string} Unique Nintendo course ID
videoid {string} YouTube video ID
difficulty {string} Course difficulty (0: Easy, 1: Normal, 2: Expert, 3: Super Expert)
lastmodified {number} Unix timestamp of last modification
uploaded {number} Unit timestamp of upload date
vPrev {number} Version number for 4:3 thumbnail (can be used for long term caching)
vFull {number} Version number for full course thumbnail (can be used for long term caching)
stars {string} Received stars
[starred] {boolean} (Authorization required) whether user has starred this course

Course64:

Attribute Value Description
id {string} Unique course ID
owner {string} Unique owner ID
title {string} Course title
uploader {string} Course uploader name
courseTheme {string} Course theme
courseStars {number} Amount of collectible stars
difficulty {string} Course difficulty (0: Easy, 1: Normal, 2: Expert, 3: Super Expert)
lastmodified {number} Unix timestamp of last modification
uploaded {number} Unit timestamp of upload date
videoid {string} YouTube video ID
vImg {number} Version number for course thumbnail (can be used for long term caching)
stars {string} Received stars
[starred] {boolean} (Authorization required) whether user has starred this course

Download course

Request: downloadcourse || downloadcourse64

Method: GET

Authorization: No

Querystring: (default values are italic)

Query Value Description
id {string} Course ID
type zip | 3ds | json | protobuf MIME type of response. 3ds supports Accept-Ranges: bytes HTTP header

Example: https://smmdb.ddns.net/api/downloadcourse?id=ihavenoidea&type=zip

Downloads course with ID ihavenoidea as zip-compressed folder.

Upload Course

Request: uploadcourse || uploadcourse64

Method: POST

Authorization: Yes

Header:

Directives Description
Content-Type: application/octet-stream

Querystring: empty

POST body: Raw binary data with header { 'Content-Type': 'application/octet-stream', 'Authorization': 'APIKEY myapikey' }. Server assumes zip/7z compressed files to contain Wii U courses. Raw binary data is checked, if it is a 3DS course. Server accepts gzipped/deflated streams.

Update course

Request: updatecourse

Method: POST

Authorization: Yes

Header:

Directives Description
Content-Type: application/octet-stream

Querystring:

Query Value Description
id {string} Course ID

POST body: Must contain JSON.stringified Object with Object properties to change.

Example: https://smmdb.ddns.net/api/updatecourse?id=mycourseid with header { 'Authorization': 'APIKEY myapikey' }' and body { 'maker': 'newMaker' }

Changes maker of course with specified course ID.

Delete course

Request: deletecourse

Method: POST

Authorization: Yes

Header:

Directives Description
Content-Type: application/octet-stream

Querystring:

Query Value Description
id {string} Course ID

Example: https://smmdb.ddns.net/api/deletecourse?id=mycourseid with header { 'Authorization': 'APIKEY myapikey' }'

Deletes course with specified course ID.

Profile Update

Request: setaccountdata

Method: POST

Authorization: Yes

Header:

Directives Description
Content-Type: application/octet-stream

Querystring: empty

POST body: Must contain JSON.stringified Object with Object properties to change.

Example: https://smmdb.ddns.net/api/setaccountdata with header { 'Authorization': 'APIKEY myapikey' }' and body { 'username': 'newUsername' }

Changes username of user with specified API key.

TODO

Add documentation for other API endpoints.