Starting with Download Monitor 5.0.0, we’ve introduced a REST API functionality that, along with an API Key generator, allows users to add/modify or delete Downloads and Versions remotely, quickly, and efficiently.
The API Key generator
In order to use the REST API system, users need API Keys sent to the endpoint so that when trying to complete actions on Downloads and Versions, the Download Monitor plugin can check for authorization and take the appropriate action.
The API Keys are found in the dashboard > Settings > General > Miscellaneous and are hidden for a standard install. A hoot to a filter is needed for them to be displayed:
add_filter( 'dlm_enable_api_keys', '__return_true' );
Keys can be generated, regenerated, and revoked for each user.
The REST API
Two separate endpoint directions are used here: the REST API for the Downloads and the REST API for the Versions.
The namespace used here for the REST API is download-monitor/v1, so you’ll need to call domain.com/wp-json/download-monitor/v1/
When sending a request, headers must be present with the x-dlm-api-key ( the Public Key ) and x-dlm-api-secret ( the Secret Key ). Otherwise, the request won’t get authorization to take the desired action.
Actions for the Downloads
Get All Downloads
This is a GET method call that retrieves all existing downloads. The endpoint for this is /downloads. There are no required parameters. This returns a JSON with the total number of Downloads and themselves.
Get certain Download
This GET method call retrieves a specific Download based on the received parameter. This endpoint is /download/download_id=xx, where xx is the Download’s ID. It has a required download_id parameter. This returns a JSON with the Download’s data, including download ID, version ID, date, version, file path, file name, file type, and number of downloads.
Delete a specific Download.
This is a DELETE method call, which deletes a specific Download based on the received parameter. The endpoint for this is /download/download_id=xxx, where xx is the Download’s ID. It has a required download_id parameter. This returns a JSON with null data and a 204 status code.
Update a specific Download.
This is a PATCH method call, which updates a specific Download based on the received parameter. The endpoint for this is /download/download_id=xxx, where xx is the Download’s ID. It has a required download_id parameter. It can update the following send parameters:
– Title ( title ): the title of the Download– Status ( status ): The status of the Download
– Author ( author ): the author of the Download
– Description ( description ): the Download description
– Short description ( excerpt ): the Download short description
– Members only locked ( _members_only ): whether to lock for members only or not
– Featured ( _featured ): set whether the Download is featured or not
– Redirect only ( _redirect_only ): whether the Download should be redirected or not
– New tab ( _new_tab ): whether to open the redirect in a new tab.
This returns a JSON with the new data of the Download
Add a Download
This is a POST method call, which updates a specific Download based on the received parameter. The endpoint for this is /download. It has a required title parameter: the Download’s title. After creating the Download, you can update it using the update endpoint and add Versions to it using the Versions REST API. Returns a JSON containing the download ID and download title in case it succeeds or an error in case it doesn’t.
Actions for the Versions
A required param for all requests is the download_id param, which holds the download’s ID.
Get All Versions
This is a GET method call that retrieves all existing versions. The endpoint for this is /versions. This returns a JSON with the total number of Versions a Download has and the Versions themselves.
Get certain Version
This GET method call retrieves a specific version based on the parameter received. This endpoint is /version/version_id=xx, where xx is the Version’s ID. It has a required version_id parameter. This returns a JSON with the Version’s data, including download ID, version ID, date, version, file path, file name, file type, and number of downloads.
Delete a certain Version.
This is a DELETE method call, which deletes a specific Version based on the received parameter. The endpoint for this is /version/version_id=xxx, where xx is the Version’s ID. It has a required version_id parameter. This returns a JSON with null data and a 204 status code.
Update a certain Version.
This is a PATCH method call, which updates a specific Version based on the received parameter. The endpoint for this is /version/version_id=xxx, where xx is the Version’s ID. It has three required params:
– version_id: The ID of the Version
– version: The version number
– URL: The file URL/pathThis returns a JSON with the new data of the Version
Add a Version
This is a POST method call, which updates a certain Download based on the received parameter. The endpoint for this is /version. It has 3 required params:
– download_id: The ID of the download
– version: The version number
– url: The file URL/pathReturns a JSON containing the download ID and download title in case it succeeds, or an error in case it doesn’t.
Other endpoints
Other REST API endpoints can be added using the “dlm_rest_endpoints” hook, which accepts the endpoints array. They will need to be created in a similar manner like the following:

Callback and permission_callback
The callback is used to send back the requested information or to do the desired manipulation.
The permission_callback is used to check for authorization. If left empty, it will default to the current user check for specific capabilities, depending on the method. The capabilities are as follows:
dlm_use_rest_api_get
dlm_use_rest_api_post
dlm_use_rest_api_update
dlm_use_rest_api_delete
To check for the API Keys, please follow the previous screenshot where the $dlm_rest_api is: $dlm_rest_api = DLM_Rest_API::get_instance();