FPC Notifier API Docs

API Version 2

GET http://scratchtools.tk/fpc/api/v2/:format/

Parameters:

:format

The format to use for data output. Current supported formats are:

  • JSON
  • XML Experimental

If as invalid format is supplied, a response with error code 2 (invalid format specified) will be issued.

Example request:

curl http://scratchtools.tk/fpc/api/v2/json/

Example output:

{
    "response":{
        "code":0,
        "description":"Success"
    },
    "curators":[
        {
            "start":"2017-01-16",
            "end":"2017-01-23",
            "user":"-Splattered-",
            "confirmed":true,
            "full":false,
            "suggest_url":"https:\/\/scratch.mit.edu\/projects\/138360713\/"
        },
        {
            "start":"2017-01-23",
            "end":"2017-01-30",
            "user":"Snow-Puppy",
            "confirmed":true,
            "full":true,
            "suggest_url":"https:\/\/scratch.mit.edu\/projects\/125472988\/"
        },
        {
            "start":"2017-01-30",
            "end":"2017-02-06",
            "user":null,
            "confirmed":false,
            "full":false,
            "suggest_url":null
        }
    ],
    "announcement":{
        "message":"",
        "priority":0
    },
    "updated":"2017-01-18 01:11:02"
}

Fields:

Response

See Response Object.

Curators

This is an array of Curator Objects.

Remarks
  • The array is ordered from the current curator to the furthest ahead curator.
  • The array will always contain at least 3 items (the current, next and following curators), even if the next and following curators are unknown.
  • There is no defined maximum length for the array.
Announcement

See Announcement Object.

Updated

The time at which the data was last updated.

Remarks:
  • Format is Y-m-d H:i:s (time zone is UTC +00:00)

Response Object:

Code

This is the numerical response code.

Remarks:
  • 0 indicates the request was successful
  • Any other (positive) value indicates an error occurred
Description

This is a description of the response code, that can be displayed on the screen if necessary.

Curator Object:

Start

This is the start date of the particularly curator's shift.

Remarks:
  • Format is Y-m-d
End

This is the end date of the particularly curator's shift.

Remarks:
  • Format is Y-m-d
User

This is the username of the curator.

Remarks:
  • The username will not be prepended with the "@" symbol.
  • If the FPC is unknown, the value will be null.
Confirmed

Indicates whether the FPC has been fully confirmed for this period.

Remarks:
  • For the current curator, this will always be set to true.
  • This will always be false if the curator is unknown.
Full

Indicates whether the FPC has no remaining project slots.

Suggest URL

The URL where the FPC is accepting project suggestions.

Remarks:
  • This will always be a scratch.mit.edu URL.
  • The URL defaults to the user's profile page.
  • If the FPC is unknown, this will be set to null.

Announcement Object:

Message

The site-wide message to display to the user.

Remarks:
  • It can contain the following HTML tags:
    • <b>
    • <u>
    • <i>
    • <a>
  • Most of the time, this value should be an empty string.
Priority

The priority of the site-wide message.

Remarks:
  • It ranges between any of the following values:
    • 0 - Information
    • 1 - Caution
    • 2 - Warning
    • 3 - Immediate attention required
  • This value defaults to 0 when no announcement is present.
API Version 1

GET http://scratchtools.tk/fpc/api/v1/:format/

Parameters:

:format
The format to use for data output. Current supported formats are:
  • JSON
  • XML Experimental

Example request:

curl http://scratchtools.tk/fpc/api/v1/json/

Example output:

{
    "current":"-programmer27",
    "following":[
        "hotwings6",
        "wonderlust"
    ],
    "date":"2016-12-05",
    "updated":"2016-12-05 21:49:12",
    "message":""
}

Fields:

Current
The username of the current FPC.
Remarks:
  • Username will not be prepended with the "@" symbol
Following
An array containing the usernames of all the following FPCs after the current one.
Remarks:
  • Usernames will not be prepended with the "@" symbol
  • There is no defined length of the array – an array of length 0 is valid
  • If an item is empty (eg. ""), the FPC should be displayed as unknown for that period
  • If an item has a question mark at the end (eg. "chooper100?"), the FPC should be displayed as unconfirmed for that period
Date
The starting date of the current FPC.
Remarks:
  • Format is Y-m-d
Updated
The time at which the data was last updated.
Remarks:
  • Format is Y-m-d H:i:s (time zone is UTC +00:00)
Message
In the event of an important message (eg. expected downtime), this field will contain the message.
Remarks:
  • Most of the time, this field will be empty.

Errors:

In the unlikely event of a server error, the responses will look like this:

{
    "error": 1
}

The error code will be a value from 1 to 5 used for debugging on my end.

If you ever see an error response, I would appreciate it if you could create a bug report over here or inform me on my Scratch profile.

By providing me with the error code and the date you sent the request, you help me ensure better stability later on.