-
Notifications
You must be signed in to change notification settings - Fork 6
APIs
GET Requests
1. Status
JSON POST Requests
1. List
2. Fetch
3. Get examples
4. Get example code
5. Get keywords
6. Get versions
7. Check for Github updates
8. Delete a library version
Description: Returns the status of the server in the form of a JSON response
Usage: GET /status
If successful, it returns: {"success": true,"status": "OK"}
General usage: The following API requests are to be POST
-ed to /{authorization_key}/v2
Note: The version field may be omitted in the following API calls. In such cases, we will check if the partner calling the API (identified using the partner's authorization key) has a preferred version for the requested library. If such preference exists, we will assume that the partner is requesting for his/her preferred version of the library. Otherwise, we will assume that the partner is requesting for the latest version of the library.
Description: List all libraries and examples
Request body: {"type":"list"}
Example:
{"type":"list"}
{
"success": true,
"text": "Successful Request!",
"categories": {
"Examples": {
"01.Basics": {
"description": "",
"examples": [
{
"name": "ReadAnalogVoltage"
},
(rest of the examples)
]
(rest of the libraries)
}
},
"Builtin Libraries": {
"EEPROM": {
"default": {
"description": "Built-in library EEPROM",
"name": "EEPROM",
"url": "http://github.com//",
"examples": [
"eeprom_clear",
(rest of the examples)
]
(rest of the versions)
},
(rest of the libraries)
}
},
"External Libraries": {
"Binary": {
"1.0.0": {
"description": "A library containing non-text files",
"name": "Binary content Library",
"url": "http://github.com//",
"examples": []
}
(rest of the versions)
},
(rest of the libraries)
}
}
}
Description: Fetches a specific version of a library
Request body: {"type":"fetch", "library":"<default_header_of_library>", "version":"<library_version>"}
Example:
{ "type":"fetch", "library":"default", "version": "1.0.0" }
{
"success": true,
"message": "Library found",
"files": {
"1.0.0": [
{
"filename": "default.h",
"content": <the content of the default.h>
},
(reset of the files)
]
(rest of the versions)
}
}
Description: Returns all examples belonging to a library version
Request body: {"type":"getExamples", "library":"<default_header_of_library>", "version":"<library_version>"}
Example:
{"type":"getExamples", "library":"default", "version":"1.0.0"}
{
"success": true,
"examples": {
"example_one": [
{
"filename": "example_one.ino",
"content": <the content of the example_one.ino>
}
]
(rest of the examples)
}
}
Description: Returns a specific example file from a library version
Request body: {"type":"getExampleCode", "library":"<default_header_of_library>", "version":"<library_version>", "example":"<example_name>"}
Example:
{"type":"getExampleCode", "library":"default", "version": "1.0.0", "example":"example_one"}
{
"success": true,
"examples": {
"example_one": [
{
"filename": "example_one.ino",
"content": <the content of the example_one.ino>
}
]
}
}
Description: Returns a list of keywords found in the keywords.txt
file of a library version
Request body: {"type":"getKeywords", "library":"<default_header_of_library>", "version":"<library_version>"}
Example:
{"type":"getKeywords", "library":"EEPROM", "version": "default"}
{
"success": true,
"keywords": {
"KEYWORD1": [
"EEPROM"
]
}
}
Description: Returns a list of versions that Eratosthenes has for a library
Request body: {"type":"getVersions", "library":"<default_header_of_library>"}
Example:
{"type":"getVersions", "library":"default"}
{
"success": true,
"versions": [
"1.0.0",
"1.1.0"
]
}
Description: Checks if any Github libraries need to be updated
Request body: {"type":"checkGithubUpdates"}
Example:
{"type":"checkGithubUpdates"}
{
"success": true,
"message": "1 external libraries need to be updated",
"libraries": [
{
"Machine Name": "DynamicArrayHelper",
"Human Name": "Dynamic Array Helper Arduino Library",
"Git Owner": "codebendercc",
"Git Repo": "DynamicArrayHelper-Arduino-Library",
"Git Branch": "1.0.x",
"Path in Git Repo": ""
}
]
}
Description: Deletes a specific version of a library. If the deleted version is the latest version of the library, you need to specify the next latest version of the library in the nextLatestVersion
field. Otherwise, it is not required.
Request body: {"type":"deleteLibrary", "library":"<default_header_of_library>", "version":"<library_version>", "nextLatestVersion":"<library_version>"}
Example:
{"type":"deleteLibrary", "library":"default", "version":"1.0.0", "nextLatestVersion":"0.9.9"}
{
"success": true,
"message": "Version 1.0.0 of the library default has been deleted successfully."
}