DarcyF1 API (0.3) Documentation
The below describes how you can interact with the DarcyF1 API. In order to use the API, you will need to be provided a set of credentials - please contact admin to discuss your use case.
Authentication
You will be provided with a Key and a Secret to authenticate to the API. Both the Key and the Secret must be included in the request's Headers.
Limits
The API is rate limited. Limits are applied to a session, and the limit is currently 10 requests per second. Requests beyond this limit will be rejected with an HTTP 429 (Too many requests) status code error.
Sending a request
The API accepts a GET request.
The request must contain the authentication Key and the Secret key-value pairs in the headers.
Response
The API will provide a JSON response. A successful API request will always include a status of success and a JSON object named api that includes information about the response itself.
Endpoint - video
The video endpoint accepts 1 to 10 video ID numbers and returns information about the video.
https://www.darcyf1.com/api/0.3/video/{videoID}
The videoID is a string containing 1 to 10 integers that are each between 1 and 6 digits long. The integers are separated by a comma (,).
Examples
https://www.darcyf1.com/api/0.3/video/123 https://www.darcyf1.com/api/0.3/video/456,88721,632,99910
Example Response
For each videoID provided, a JSON object will be returned. The data included within this video object will vary depending on the video.
A request of https://www.darcyf1.com/api/0.3/video/2456,88721,632,99910 returns the following response.
[
{
"id": "2456",
"metadata": {
"category": "GP2",
"season": "2007",
"race": "monaco",
"hosted_by": "darcyf1",
"commentary": "eng",
"action_type": "clip",
"upload_timestamp_utc": 0,
"uploader_username": "admin",
"views": "1136",
"favourited": 0,
"comments": 1,
"sensitivity": "none",
"last_edited": 0
},
"media": {
"video": {
"url": "https://www.darcyf1.com/videos/gp2/2007/monaco/Monaco07_Rodriguez_Crashes.avi",
"filesize": 15.98,
"resolution": {
"width": 512,
"height": 384
},
"codec": {
"video": "mpeg4",
"audio": "mp3"
},
"bitrate": "1620",
"duration": "00:01:22.7",
"framerate": 25
},
"thumbnail": {
"featured": "https://www.darcyf1.com/videos/gp2/2007/monaco/thumbs/04.jpg",
"preview": "https://www.darcyf1.com/videos/gp2/2007/monaco/thumbs/2456.prev.jpg",
"map": "https://www.darcyf1.com/videos/gp2/2007/monaco/2456.thumbs.vtt"
},
"html5": "https://www.darcyf1.com/videos/gp2/2007/monaco/Monaco07_Rodriguez_Crashes.mp4"
}
},
{
"id": "88721",
"metadata": {
"category": "United_SportsCars",
"season": "2018",
"race": "Sebring",
"hosted_by": "youtube",
"commentary": "zxx",
"action_type": "clip",
"upload_timestamp_utc": 1521897093,
"uploader_username": "vettelisthebest",
"views": "254",
"favourited": 0,
"comments": 1,
"sensitivity": "none",
"last_edited": 1521897101
},
"media": {
"video": "",
"thumbnail": {
"featured": "https://img.youtube.com/vi/U4Enks0hs8Q/mqdefault.jpg"
},
"html5": "https://www.youtube.com/embed/U4Enks0hs8Q?rel=0"
}
},
{
"id": "99910",
"metadata": {
"category": "IndyCar",
"season": "1997",
"race": "Mid_Ohio",
"hosted_by": "darcyf1",
"commentary": "eng",
"action_type": "clip",
"upload_timestamp_utc": 1540469417,
"uploader_username": "mattia",
"views": "207",
"favourited": 0,
"comments": 0,
"sensitivity": "none",
"last_edited": 1582675618
},
"media": {
"video": {
"url": "https://www.darcyf1.com/videos/indycar/1997/mid_ohio/MidOhio_1997_FP_DeFerran_Crash.mp4",
"filesize": 1.27,
"resolution": {
"width": 480,
"height": 360
},
"codec": {
"video": "h264",
"audio": "aac"
},
"bitrate": "508",
"duration": "00:00:20.9",
"framerate": 25
},
"thumbnail": {
"featured": "https://www.darcyf1.com/videos/indycar/1997/mid_ohio/thumbs/99910.jpg",
"preview": "https://www.darcyf1.com/videos/indycar/1997/mid_ohio/thumbs/99910.prev.jpg",
"map": "https://www.darcyf1.com/videos/indycar/1997/mid_ohio/99910.thumbs.vtt"
},
"html5": ""
}
},
{
"api": {
"version": "0.3",
"current": "0.3",
"time_utc": 1626825277,
"execution": 111.98
},
"status": "success",
"warnings": [
"Video ID 632 does not match a video hosted on DarcyF1."
]
}
]
The following table details the keys that can be returned, along with example values.
| Parent Object | Key | Type | Description | Example Value |
|---|---|---|---|---|
null |
replacedBy | integer | Only present when video has been replaced on DarcyF1 | 965224 |
null |
id | integer | videoID presented in request | 42589 |
null |
metadata | object | Contains information about how the video is categorised on DarcyF1 | |
| metadata | category | string | Racing category, as recorded on DarcyF1 | IndyCar |
| metadata | season | string | Typically a calendar year, can also be 'TV' for non-sporting content | 2021 |
| metadata | race | string | The track, country, round name, event, or other ways of subcategorising video content. May be an empty string. | australia |
| metadata | hosted_by | string | Identified where the video content is hosted. Either on DarcyF1, in the DarcyF1 archives or on a third-party video sharing service such as Youtube.darcyf1 | darcyf1_archives | youtube | dailymotion | vimeo |
darcyf1 |
| metadata | commentary | string | ISO 639-3 code to identifies the commentary language in the video. Note values include zxx (no linguistic content) for videos without commentary, and und (undetermined) for videos where the language of the commentary has not been identified. |
eng |
| metadata | action_type | string | Either session or clip - identifies if the video is categorised as a full session or not |
clip |
| metadata | upload_timestamp_utc | integer | Seconds after unix epoch that the video was uploaded to DarcyF1. Can be 0 for videos uploaded prior to 2010. |
1521897093
|
| metdata | uploader_username | string | The username chosen by the uploader of the video. Is not a static value. Will be no longer than 25 characters. | mattia |
| metadata | views | integer | Number of views a video has received on DarcyF1 | 4423 |
| metadata | favourited | integer | Number of users who have added this video to their favourites. Note UK English spelling. | 3 |
| metadata | comments | integer | Number of comments on the video. Includes thumbs-ups which auto-comments a user's pre-set thank message. | 6 |
| metadata | sensitivity | string | Identifies if the video caries a viewer discretion warning on DarcyF1. One of none | injury | fatality |
injury |
| metadata | last_edited | integer | Seconds after unix epoch that the video details were most recently edited. Will be the same as upload_time_stamp if never edited on DarcyF1. |
1521862547 |
| metadata | credit | object | Original creator of the video as nominated by the uploader | |
| credit | name | string | A descriptive name given to the source of the video, such as a username, YouTube account, or website | UkF1 |
| credit | url | string | URL linking to the website, YouTube channel or similar of the original creator of the video | http://ukf1.net |
null |
media | object | Contains information about the media files | |
| media | video | object | Contains information about the video file | |
| video | url | string | URL to the video file. Likely to be empty when hosted_by is not darcyf1 |
https://www.darcyf1.com/videos/indycar/1997/mid_ohio/MidOhio_1997_FP_DeFerran_Crash.mp4 |
| video | filesize | float | Filesize in megabytes of the video file for videos currently or formerly hosted on DarcyF1. Will include two decimal places. | 47.24 |
| video | resolution | object | Contains information about the video resolution if currently or formerly hosted on DarcyF1. Can be used to calculate the aspect ratio. | |
| resolution | width | integer | Width of the video in pixels. | 1280 |
| resolution | height | integer | Height of the video in pixels. | 720 |
| video | codec | object | Contains information about the codec families. | |
| codec | video | string | Video codec family used to encode the video file. | h264 |
| codec | audio | string | Audio codec family used to encode the video file. | aac |
| video | bitrate | string | Average or constant bit rate of the video file, in kbps. | 1504 |
| video | duration | string | Duration of the video in hours, minutes, and seconds (with one decimal place). Format will always be xx:xx:xx.x regardless of the duration. | 01:32:20.9 |
| video | framerate | integer | Frames per second of the video file. | 50 |
| media | thumbnail | object | Contains information about the preview image(s) for a video. | |
| thumbnail | featured | string | URL for the thumbnail image displayed for the video across DarcyF1. Will include URLs for images on DarcyF1 and third party video sites. | https://www.darcyf1.com/videos/gp2/2007/monaco/thumbs/04.jpg |
| thumbnail | preview | string | URL for an image that is a matrix (5x5) of thumbnails throughout the length of the video. This can be used to generate a preview by rapidly switching through each frame, or provide video scrubbing hints by aligning each frame to an appropriate time code (see below). This can be empty for DarcyF1-hosted videos and will be empty for externally hosted videos. | https://www.darcyf1.com/videos/gp2/2007/monaco/thumbs/2456.prev.jpg |
| thumbnail | map | string | This WebVTT file provides a map between the above preview image and the video file. This file only includes relative file paths rather than URLs for the above preview image. This may be empty for DarcyF1-hosted videos and will be empty for externally hosted videos. | https://www.darcyf1.com/videos/gp2/2007/monaco/2456.thumbs.vtt |
| media | html5 | string | URL to an HTML5-compliant video file, for playback in modern web-browsers. This value may be the same as media/video/url if the source video is HTML5 compliant. May be empty. |
https://www.darcyf1.com/videos/gp2/2007/monaco/Monaco07_Rodriguez_Crashes.mp4 |
Endpoint - me
The me endpoint provides access to information about the requesting user's profile on DarcyF1.
https://www.darcyf1.com/api/0.3/me/{detail}
The optional detail attribute is a string from the following options, and determines which information is returned.
Examples
https://www.darcyf1.com/api/0.3/me/ https://www.darcyf1.com/api/0.3/me/all https://www.darcyf1.com/api/0.3/me/cards https://www.darcyf1.com/api/0.3/me/friends
Example Response
A request of https://www.darcyf1.com/api/0.3/me/all made by the user cardtest2 returns the following response. Note, the cards section has been truncated for brevity.
[
{
"username": "cardtest2",
"status": "active",
"email": {
"address": "[email protected]",
"verified": "Yes"
},
"xp": 779,
"tokens": 252,
"rank": 4,
"registration_utc": 1523067180,
"last_login_utc": 1639517756,
"last_visit_utc": 1639517995,
"donations_usd": 0,
"donator_status": 0,
"videos": {
"comments": 0,
"favourites": 0,
"uploads": 0,
"skip_moderation_categories": [
"No"
]
},
"friends": 1,
"invitations": 1,
"invited_by_user": null,
"cardspy_trial_status": "active",
"preferences": {
"avatar_url": "https://avatars.darcyf1.download/cardtest25436.jpg",
"paypal_email": "",
"video_subscriptions": [],
"profile_activities": [
"donated",
"comment"
],
"personal_external_url": "",
"custom_title": "",
"block_message_types": [],
"site_components": {
"cards": 1,
"tipping_f1": 0,
"tipping_v8": 0,
"thumbhunt": 1,
"upload_videos": "1"
},
"hide_recent_videos": 0,
"banner": 0,
"theme": "dark",
"favourite_card": 0,
"timezone": "America/Los_Angeles",
"thumbs_up_message": "Thank you"
}
},
{
"cards": {
"sets_completed": [],
"115219": {
"serial": "1.1",
"inverse": 0,
"collected": {
"time_utc": 1560477069,
"method": "gift",
"from_user": "admin"
}
},
.
.
.
.
.
"462155": {
"serial": "1.10",
"inverse": 0,
"collected": {
"time_utc": 1598063525,
"method": "trade",
"from_user": "admin"
}
}
}
},
{
"friends": {
"admin": {
"time_utc": 1637040175,
"level": 4,
"friendship_points": 581
}
}
},
{
"api": {
"version": "0.3",
"current": "0.3",
"time_utc": 1640300469,
"execution": 504
},
"status": "success"
}
]
The following table details the keys that can be returned, along with example values.
/me/ or /me/all
| Parent Object | Key | Type | Description | Example Value |
|---|---|---|---|---|
null |
username | string | Username of the user making the API request | schumacher_fan21 |
null |
status | string | Status of the account | active | disabled | deleted | warned |
null |
object | Email address attached to the user account | ||
| address | string | The address | [email protected] | |
email |
verified | string | Identifies if the address has been verified by a user clicking on an emailed verification link | Yes | No |
null |
xp | integer | Current experience points (XP) earned | 7613 |
null |
tokens | integer | Current tokens balance. Token limit can be inferred by multiplying rank by 100 (floor of 500). |
412 |
null |
rank | integer | Current level of the user account. | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
null |
registration_utc | integer | Seconds after unix epoch that the user account was created | 1523067180 |
null |
last_login_utc | integer | Seconds after unix epoch that the user account was last logged into | 1523067180 |
null |
last_visit_utc | integer | Seconds after unix epoch that the user account was last active on DarcyF1. | 1523067180 |
null |
donations_usd | integer | Cumulative total of user-claimed and staff-verified donations made to the DarcyF1 fundraiser. US Dollars. | 25 |
null |
donator_status | integer | If user has made a donation of $1 or more in past month, status will be 1 | 0 | 1 |
null |
videos | object | Metrics regarding user interactions with published videos | |
| videos | comments | integer | Total of all comments made on videos | 1726 |
| videos | favourites | integer | Total of videos that the user has favourited | 124 |
| videos | uploads | integer | Total of videos that user has uploaded, includes videos still pending moderation by staff | 732 |
| videos | skip_moderation_categories | array of strings | List of categories for which a user's video submissions bypass moderation | {No} | {Indycar, WRC, BTCC} |
null |
friends | integer | Total number of user accounts that the user has connected with through the DarcyF1 friends function | 12 |
null |
invitations | integer | Number of available invitations for the user to use | 3 |
null |
invited_by_user | string | If the user created their account by using an invitation code, the username of the user who created the invitation will be listed here. Otherwise null. The username is accurate at the time of account creation. | null | hakkinen_fan12 |
null |
cardspyTrial | string | Identifies if the user has used their limitd time trial of the CardSpy feature | available | active | used |
null |
staff_role | string | Only returned for members of DarcyF1 staff. | Administrator | Moderator |
null |
staff_moderation | object | Staff permissions held by the user. Many permissions apply to all staff, these are set per staff member. Staff with staff_role of Administrator have all permissions. |
|
| staff_moderation | uploads | integer | Staff member can approve the addition or removal of videos from the website | 0 | 1 |
| staff_moderation | tipping_f1 | integer | Staff member can populate F1 Tipping results | 0 | 1 |
| staff_moderation | search | integer | Staff member can provide search suggestions | 0 | 1 |
| staff_moderation | deleted_videos | integer | Staff member can action video deletion requests | 0 | 1 |
| staff_moderation | problem_reports | integer | Staff member can action problem reports submitted by other users. | 0 | 1 |
| staff_moderation | tipping_supercars | integer | Staff member can populate Supercars Tipping results | 0 | 1 |
| staff_moderation | onboard_laps | integer | Staff member can add published videos to the Onboard Laps listing. | 0 | 1 |
| staff_moderation | bulk_video_edit | integer | Staff member can use the bulk editing tool to move multiple videos between categories | 0 | 1 |
null |
preferences | object | List of user-modifiable profile options that determines how the site functions, and how their account appears across the site. | |
| preferences | avatar_url | string | URL to profile image. Will return an empty string where user does not have a profile image set. | https://avatars.darcyf1.download/cardtest25436.jpg |
| preferences | paypal_email | string | Email address via which the user can accept donations | [email protected] |
| preferences | video_subscriptions | array of strings | List of user subscriptions to certain video categories (and / or seasons) that helps determine what videos are presented to them on the home page in the format of category.season | {Supercars.all,INDYCAR.2005,BTCC.all,Formula1.all,GP2.2009,WTCR.all,WRC.all} |
| preferences | profile_activities | array of strings | Determines what actions are displayed on the user's profile page. Video uploads are displayed by default | {comment,donated} |
| preferences | personal_external_url | string | A link to a website that can be displayed on a user's profile | https://www.youtube.com/user/crashclips |
| preferences | custom_title | string | Ranked up users can set a custom title displayed on their profile. May be empty string. | Uploader Extraordinare |
| preferences | site_components | object | User-controllabe on/off switches for certain site components | |
| site_components | cards | integer | DarcyF1 collector cards. Default 1. | 0 | 1 |
| site_components | tipping_f1 | integer | F1 Tipping competition. Default 0. | 0 | 1 |
| site_components | tipping_v8 | integer | Supercars Tipping competition. Default 0. | 0 | 1 |
| site_components | thumbhunt | integer | ThumbHunt quests. Default 1. | 0 | 1 |
| site_components | upload_videos | integer | Can user upload videos. Not user-modifiable. Default 1. | 0 | 1 |
| preferences | hide_recent_videos | integer | Seconds for which to delay display of uploaded videos that are from the current calendar year. | 86400 |
| preferences | banner | integer | ID of the profile banner the user is currently displaying | 3 |
| preferences | theme | string | Name of the theme currently set by the user for the display of DarcyF1. Deafult 'dark'. | dark | darcyf1 | redbull etc. |
| preferences | favourite_card | integer | Unique ID of the user's favourite card, displayed on their profile. This is not the card's serial number. More details about this card can be found using the /me/cards or /me/all endpoint (detailed below). |
872312 |
| preferences | timezone | string | IANA timezone identifier that the user has selected to display certain elements of the site in their local timezone | Europe/Paris |
| preferences | thumbs_up_message | string | A brief message automatically commented to videos when the user presses the thumbs up button | Awesome, thanks! |
/me/cards or /me/all
| Parent Object | Key | Type | Description | Example Value |
|---|---|---|---|---|
null |
cards | object | Collector card assets completed / collected by user | |
| cards | sets_completed | object | List of objects, card sets that the user has collected all cards for. Set remains 'completed' forever. | |
| sets_completed | {set id} | object | This object identifier is the set ID of the completed set. | 1 | 2 | 3 etc. |
| {set id} | {set name} | string | Lists the title of the completed set. If the set is part of a parent category, it will be in the format of Parent Category - Set Name |
Formula One - 2014 Grands Prix |
| cards | {unique card ID} | object | Contains informaton about a single card currently in a user's collection | |
| {unique card ID} | serial | string | Serial number of the card, as displayed on the card | 21.14 |
| {unique card ID} | inverse | integer | Whether the card is inverse (a rare version that displays alternate colours) | 0 | 1 |
| {unique card ID} | collected | object | How and when the card was collected | |
| collected | time_utc | integer | Seconds since unix epoch that the card was collected by the user | 1640305718 |
| colleted | method | string | How the card was collected | booster | drop | trade (etc.) |
| colleted | from_user | string | If the card came from another user, such as a gift or trade, the previous owner's username will be listed here. | hill_fan96 |
/me/friends or /me/all
| Parent Object | Key | Type | Description | Example Value |
|---|---|---|---|---|
null |
friends | object | Contains information about users with whom the user is friends on DarcyF1 | |
| friends | {friend_username} | object | This object's name will be the username of the friend | |
| {friend_username} | time_utc | integer | Seconds since unix epoch that the friendship commenced | 1640305718 |
| {friend_username} | level | integer | The current level of the friendship with this user | 1 | 2 | 3 | 4 | 5 |
| {friend_username} | friendship_points | integer | How many points this friendship have progressed. | 362 |
| {friend_username} | status | string | Will identify if the friendship is still awaiting acceptance from the other party | Friend invitation awaiting acceptance. |
API Status
Response included in all API queries| Parent Object | Key | Type | Description | Example Value |
|---|---|---|---|---|
null |
api | object | Contains information about the API response. | |
| api | version | string | Version of the API providing the response. | 0.3 |
| api | version | string | Most current version of the API. | 0.3 |
| api | time_utc | integer | The time (UTC) that the API provided the response. | 1616455884 |
| api | execution | float | How many milliseconds the API script took to generate a response. Includes two decimal places. | 3.92 |
null |
status | string | Identifies whether the API returned any errors. Either success or error |
success |
null |
errors | array of strings | Descriptive text for any error(s) generated while attempting to generate a response. If present, will contain one or more entries. Will only be present if status is error |
More than 10 video IDs provided. Limit your request to 10 video IDs. |
null |
warnings | array of strings | Descriptive text for any warning(s) generated while attempting to generate a response. If present, will contain one or more entries. | Video ID 1234 has been removed from DarcyF1, and replaced by Video ID 5678. |
Errors
The API will return a JSON object that includes a key named status that will list a value of either success or error. When an error status is returned, the JSON response will include a key called errors which is an array of string(s) that describe the error(s).
Example
The below is a response to a request that is missing the API Authentication headers.
[
{
"errors": [
"API credentials not supplied."
],
"status": "error"
}
]
PHP + CURL Example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.darcyf1.com/api/0.3/video/2456,88721,632,99910',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Key: redacted',
'Secret: redacted'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Change Log (from 0.2)
[{"metadata":{"commentary"}}]- Commentary language is now presented as ISO 639-3 lanugage code instead of a ISO 3166-1-alpha-2 country code.[{"metadata":{"uploader_url"}}]- Removed. Static URL can be inferred from[{"metadata":{"uploader"}}][{"metadata":{"last_edited"}}]- Added.[{"metadata":{"favourited"}}]- Added.[{"metadata":{"comments"}}]- Added.[{"metadata":{"credit":{"name"}}}]- Added.[{"metadata":{"credit":{"url"}}}]- Added.[{"metadata":{"upload_timestamp_utc"}}]- Data type changed to integer.[{"metadata":{"views"}}]- Data type changed to integer.[{"media":{"video":{"resolution":{"width"}}}}]- Data type changed to integer.[{"media":{"video":{"resolution":{"height"}}}}]- Data type changed to integer.[{"media":{"video":{"filesize"}}}]- Data type changed to float.[{"media":{"video":{"framerate"}}}]- Data type changed to integer.[{"media":{"html5"}}]- Will now return as an empty string if there is an unresolved automated error report from our web player. Once staff have marked the issue resolved, this key will return its usual value.[{"errors"}]- New error condition added when none of the video IDs provided match a video hosted on DarcyF1. If some videos match and others don't, a warning will be returned.[{"warnings"}]- A new array of strings which will return any issues that don't prevent the API from responding successfully but may be providing unexpected data.[{"warnings"}]- A new warning added for each video ID provided that does not match a video hosted on DarcyF1.[{"warnings"}]- A new warning added for when a video has been replaced on DarcyF1 (typically with a better version). Note this warning also the following attribute.[{"replacedBy"}]- Added video ID of new video when requested video has been replaced on DarcyF1.me- Endpoint added.