POST http://yourserver.com/services/logUsage ?assetId=<asset id> &action=<CUSTOM_ACTION_YOUR_ACTION> &<queryParam>=<value> |
What does it do?
Logs an entry in the stats database for usage statistics about assets. A record will be added to the "usage_log" table.
Most information in the "usage_log" table is automatically filled based on the currently authenticated user and the specified assetId: log_date, user_name, user_groups, client_type, remote_addr, remote_host, action_type, asset_id, asset_path, asset_type, asset_domain, details.
Note: For information about how to configure custom metadata fields in such a way that they are searchable by this API, see Searchable custom stats metadata in Assets Server.)
Log in requirement
Before being able to request information from Assets Server by using a GET request or make changes to the system through a POST request, a log in to Assets Server is required. For information about the available APIs for logging in, see Assets Server REST API - introduction.
POST requests only
This REST API only accepts POST requests, not GET requests. Also, the POST request needs to include a cross-site request forgery (csrf) token.
The csrf token is a unique code which, by including it in the request, also makes the POST request unique and therefore much more secure.
The csrf token is obtained by first logging in to Assets Server through a POST request. The response that is received will include the csrf token which can then be used in subsequent POST requests as a http header:
"X-CSRF-TOKEN: <some_csrf_token>"
For more information including examples, see Assets Server REST API - Performing a POST request with a csrf token.
Parameters
assetId |
The id of the asset for which the action is logged. Required. |
action |
Name of the action that is logged. This must start with "CUSTOM_ACTION_", if it does not, this prefix will be added to the logged action name. Required. |
* |
All other parameters are logged as details for the action. Optional. |
Return value
This call does not return a value, it only returns an http 200 status OK.
Examples
logUsage http://demo.assets-server.com/services/logUsage ?assetId=5LMAQTW9qfhANn7f6JJVpl &action=CUSTOM_ACTION_moved_to_trash &insertSize=400x300 &pageUrl=http://www.example.com/my-first-blog-post |
Comment
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
0 comments
Please sign in to leave a comment.