Dokky PRO API Documentation
In this section you can check the various API Requests and requirements.
Directions
An JWT Token is required for requests to be processed by the system.
Once a User registers, an JWT Token is automatically generated for this user.
If the JWT is not sent or is expired, there will be an error.
Please make sure to keep your JWT Token is a safe place, to prevent abuse.
API Menu
Dokky PRO - API REFERENCE FOR DEVELOPERS
AUTENTICATION
Note: To authenticate with the API system, you need to send your JWT as an Authorization Token with each request. You can see the sample code below.
RATE LIMIT
Note: Our API has a rate limiter to safeguard against spike in requests to maximize its stability. Our rate limiter is currently caped at 30 requests per 1 minute.
Several headers will be sent alongside the response and these can be examined to determine various information about the request.
RESPONSE HANDLING
Note: All API response are returned in JSON format by default.
To convert this into usable data, the appropriate function will need to be used according to the language. In PHP for example, the function json_decode() can be used to convert the data to either an object (default) or an array (set the second parameter to true).
It is very important to check the error key as that provides information on whether there was an error or not.
You can also check the header code.
API UPLOAD FILE - [POST]
This API allows you to upload a file to the server by specifying various metadata such as title, description, tags, and license. It can also create a new category for the file if necessary.
Example curl
request
curl -X POST "https://dokky.scriptnet.net/api/V1/docs/api-upload" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/file.pdf" \
-F "title=Upload via API" \
-F "description=Upload File via API" \
-F "tags=tag1, tag2, upload, api, pdf, scriptnet" \
-F "category_id=1" \
-F "cc_license=CC BY" \
Required parameters
- file (required): The file to upload.
- title (required): The title of the file.
- description (required): A description of the file.
- tags (required): The tags associated with the file, separated by commas.
- category_id (required): The ID of the existing category.
- new_category_name (optional): The name of the new category to create (if category_id is not provided).
- category_description (optional): The description of the new category.
- category_tags (optional): The tags associated with the new category, separated by commas.
- cc_license (required): The Creative Commons license for the file (e.g. 'CC BY') (List).
- video (optional): URL of an associated video (e.g. YouTube or Vimeo).
Example of a complete request
curl -X POST "https://dokky.scriptnet.net/api/V1/docs/api-upload" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/file.pdf" \
-F "title=Upload via API" \
-F "description=Upload File via API" \
-F "tags=tag1, tag2, upload, api, pdf, scriptnet" \
-F "new_category_name=New Category Name" \
-F "category_description=New Category Description" \
-F "category_tags=tag1, tag2" \
-F "cc_license=CC BY-NC-ND" \
-F "video="
Sample answer
{ "status": "success", "message": "File uploaded successfully.", "file_id": "12345", "category_id": "1", "category_name": "New Category"
}
API Download File - [GET]
This API allows you to download a file from the server by specifying the file ID. It verifies that the file is available for download and is not for sale or disabled.
Example curl
request
curl -X GET "https://dokky.scriptnet.net/api/V1/docs/api-download?file_id=123" \
-H "X-Authorization: Bearer Your JWT Token here"
Required parameters
file_id
(required): The ID of the file to download.- Header
X-Authorization
: JWT token required for authentication.
Example of a complete request
curl -X GET "https://dokky.scriptnet.net/api/V1/docs/api-download?file_id=123" \
-H "X-Authorization: Bearer Your JWT Token here"
Successful response
{ "status": "success", "original_file_name": "File_Name.pdf", "message": "File downloaded successfully"
}
Possible error responses
{ "status": "error", "message": "Rate limit exceeded. Please try again later."
}
{ "status": "error", "message": "File ID is required"
}
{ "status": "error", "message": "File not found"
}
{ "status": "error", "message": "File is either for sale or not enabled"
}
{ "status": "error", "message": "Invalid request method"
}
API Delete File - [DELETE]
This API allows you to delete a file by specifying its ID. A valid JWT token is required to authenticate the file deletion request.
Example curl
request
curl -X DELETE "https://dokky.scriptnet.net/api/V1/docs/api-delete" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json" \
-d '{"id": "20"}'
Required parameters
id
(required): The ID of the file to delete.- Header
X-Authorization
: JWT token required for authentication. - Header
Content-Type
: Set toapplication/json
to send data in JSON format.
Example of a complete request
curl -X DELETE "https://dokky.scriptnet.net/api/V1/docs/api-delete" \
-H "X-Authorization: Your JWT Token here \
-H "Content-Type: application/json" \
-d '{"id": "20"}'
Successful response
{ "status": "success", "message": "File deleted successfully"
}
Possible error responses
{ "status": "error", "message": "Missing JWT token"
}
{ "status": "error", "message": "File ID is required"
}
{ "status": "error", "message": "File not found"
}
{ "status": "error", "message": "Invalid JWT token"
}
{ "status": "error", "message": "Error during deletion"
}
API Search File - [POST]
This API allows you to search for files by specifying a search term. A valid JWT token is required to authenticate the search request.
Example curl
request
curl -X POST "https://dokky.scriptnet.net/api/V1/stats/api-search" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json" \
-d '{"search": "your-search-term"}'
Required parameters
search
(required): The search term used to find the files.- Header
X-Authorization
: JWT token required for authentication. - Header
Content-Type
: Set toapplication/json
to send data in JSON format.
Example of a complete request
curl -X POST "https://dokky.scriptnet.net/api/V1/stats/api-search" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json" \
-d '{"search": "document"}'
Successful response
{ "status": "success", "results": [ { "id": "123", "title": "Document Title", "link": "https://dokky.scriptnet.net/view/123", "description": "A brief description of the document", "category": "Category Name", "tag": "tag1, tag2" } ]
}
Possible error responses
{ "status": "error", "message": "Missing JWT token"
}
{ "status": "error", "message": "Search term is required"
}
{ "status": "error", "message": "No results found"
}
{ "status": "error", "message": "Invalid JWT token"
}
{ "status": "error", "message": "Error during search"
}
API User Stats - [POST]
This API provides statistics about the authenticated user, such as total number of comments, uploaded files, views, downloads, and sales. A valid JWT token is required to authenticate the request.
Example curl
request
curl -X POST "https://dokky.scriptnet.net/api/V1/stats/api-stats" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json"
Required parameters
- Header
X-Authorization
: JWT token required for authentication. - Header
Content-Type
: Set toapplication/json
to send data in JSON format..
Example of a complete request
curl -X POST "https://dokky.scriptnet.net/api/V1/stats/api-stats" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json"
Successful response
{ "status": "success", "data": { "total_comments": 45, "total_files": 120, "total_views": 10500, "total_downloads": 800, "total_sales": 50 }
}
Description of fields in the response
total_comments
: Total number of user comments.total_files
: Total number of files uploaded by the user.total_views
: Total number of views of the user's files.total_downloads
: Total number of user file downloads.total_sales
: Total number of user file sales.
Possible error responses
{ "status": "error", "message": "Missing JWT token"
}
{ "status": "error", "message": "Invalid JWT token"
}
{ "status": "error", "message": "Error fetching user stats"
}
API User Files - [GET]
This API allows you to get the list of files uploaded by a given user. A valid JWT token is required to authenticate the request. You can specify the user ID to view the uploaded files.
Example curl
request
curl -X GET "https://dokky.scriptnet.net/api/V1/users/api-files?user_id=1" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json"
Required parameters
- Query Parameter
user_id
: ID of the user whose files you want to get. - Header
X-Authorization
: JWT token required for authentication. - Header
Content-Type
: Set toapplication/json
to send data in JSON format..
Example of a complete request
curl -X GET "https://dokky.scriptnet.net/api/V1/users/api-files?user_id=1" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json"
Successful response
{ "status": "success", "user": { "id": 1, "name": "John Doe" }, "files": [ { "file_id": 101, "upload_date": "2024-10-01", "title": "SEO Report", "description": "SEO Report October", "file_url": "https://dokky.scriptnet.net/view?report_october.pdf" }, { "file_id": 102, "upload_date": "2024-09-15", "title": "Preview SEO Project", "description": "Preview of the new SEO Project", "file_url": "https://dokky.scriptnet.net/view?project_preview.pdf" } ]
}
Description of fields in the response
status
: Response status (for example,success
).user
: User information (ID and name).files
: List of files uploaded by the user.file_id
: Unique file ID.upload_date
: Date the file was uploaded.title
: File Title.description
: File Description.file_url
: URL to access the file.
Possible error responses
{ "status": "error", "message": "Missing JWT token"
}
{ "status": "error", "message": "Invalid JWT token"
}
{ "status": "error", "message": "User not found"
}
API User Comments - [POST]
This API allows you to get the comments received by an authenticated user. You must provide a valid JWT token to access this resource.
Example curl
request
curl -X POST "https://dokky.scriptnet.net/api/V1/users/api-comments" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json"
Required parameters
- Header
X-Authorization
: JWT token required for authentication. - Header
Content-Type
: Set toapplication/json
to send data in JSON format..
Example of a complete request
curl -X POST "https://dokky.scriptnet.net/api/V1/users/api-comments" \
-H "X-Authorization: Bearer Your JWT Token here" \
-H "Content-Type: application/json"
Successful response
{ "status": "success", "data": [ { "comment_id": 201, "submission_date": "2024-10-05", "title": "Monthly Report Project", "comment": "I love the details of this Project, compliments!", "link": "https://dokky.scriptnet.net/view/report_october" }, { "comment_id": 202, "submission_date": "2024-09-20", "title": "Project Introduction", "comment": "This is an exellent Introduction! Well done!", "link": "https://dokky.scriptnet.net/view/project_preview" } ]
}
Description of fields in the response
status
: Response status (for example,success
).data
: List of comments received.comment_id
: Unique comment ID.submission_date
: Date the comment was posted.title
: Title of the content the comment refers to.comment
: Text of the comment received.link
: URL of the commented content.
Possible error responses
{ "status": "error", "message": "Missing JWT token"
}
{ "status": "error", "message": "Invalid JWT token"
}
{ "status": "error", "message": "User not found"
}