The User
resource type represents an individual CodeGuard account. This API can only be used to create and delete users.
Requests to the User
resource can only be made by authenticated partners. The api_key parameter must be passed with every request and contain a valid Partner API Key.
The following are the attributes associated with the User
resource. Whether they are required or optional is specified in the sections that follow.
The individuals full name. This is used for salutations in email communication and display in the application interface.
The email address to be associated with this account. Email is used for logging in to the application interface as well as communication.
The password associated with the user account. For partners that do not permit direct-login to the CodeGuard application this attribute is not supported. Note: This can only be specified during user creation. It is never returned in a response and it is not accepted in other contexts.
The text representation of the desired time zone to use for displaying time and date data. A list of supported time zones is included in the appendix at the end of this document.
Unique numeric ID used to identify the user resource in the CodeGuard application.
The account size in bytes of the user resource.
User-specific OAuth access token for CodeGuard API access. Note: These values are only returned after the user creation request. They are not settable using this API and they are never returned as part of the user resource after creation.
User-specific OAuth secret for CodeGuard API access. Note: These values are only returned after the user creation request. They are not settable using this API and they are never returned as part of the user resource after creation.
User-specific OAuth access token for CodeGuard API access. Note: These values are only returned after the user creation request. They are not settable using this API and they are never returned as part of the user resource after creation.
User-specific OAuth secret for CodeGuard API access. Note: These values are only returned after the user creation request. They are not settable using this API and they are never returned as part of the user resource after creation.
This is a flexible text field that can be used for partners to store user-specific information they may need to identify the user.
The plan_id represents the CodeGuard plan associated with the user. The plan dictates the features and limits that govern the User
account.
This field indicates if the User
account is enabled and functional (true) or has been suspended (false).
This attribute is used to search user accounts by name or email address.
If you have a large set of users, this parameter is used to paginate records and show you the Nth page of records.
This method is used to create new CodeGuard users.
URI: /users
Method: POST
The request will not succeed without these attributes.
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{"user" : {"name" : "A User", "email" : "first.lastname@co.com", "partner_data" : "{\"package_id\":\"ppp-123456\"}"}}' https://api.codeguard.com/users?api_key=012c513e6d309c158a19bcbc86bb7a88
{
"user": {
"id":39763,
"name":"A User",
"email":"first.lastname@co.com",
"access_secret":"HRzHGqskj3DNdOCYbPDv92HYKplwW6PyESEl8cwB",
"api_secret":"1H3kUaaIj5LiGvICDUiOR2aQC8mYkV6MPMsX6xMG",
"api_key":"u1xe85RrWhpJim3xslJb9GI9ENms6PmFjYDeTOgc",
"access_token":"qFFTIQszYZwHc4KmeZciyFjHT9XdcsRGrgkgwPQr",
"time_zone":"UTC",
"partner_data" : "{\"package_id\":\"ppp-123456\"}",
"plan_id":88
}
}
URI: /users/<USER ID>
Method: GET
The request will not succeed without these attributes.
None
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X GET https://api.codeguard.com/users/48767?api_key=012c513e6d309c158a19bcbc86bb7a88
{
"user": {
"name":"A User",
"size":12374124,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"user@example.com",
"plan_id":88
"website_count_limit": 1,
"website_count": 0,
"database_count_limit": 1,
"database_count": 0,
"over_quota": false
"feature_set": {
"disable_static_filtering": false,
"ip_logging": false,
"multi_user": false,
"email_notifications_disabled_by_default": false,
"reseller": false,
"wp_management": false,
"uptime_monitor": false,
"backups": true,
"manual_backup": false,
"monitoring_frequency_daily": false,
"monitoring_frequency_weekly": false,
"monitoring_frequency_monthly": false,
"paid_restores": false,
"malware_gone": false,
"migration": false,
"site_lock_lite": false,
"site_lock_web_secure": false
}
}
}
This method is used to delete existing CodeGuard users that were created by a Partner. Parters can not delete users created by other partners. Deleting a user resource will also delete all associated Website
and Database
records.
URI: /users/<id>
Method: DELETE
None
curl -i -X DELETE https://api.codeguard.com/users/377?api_key=3a912fdd3c8657584aa8f4bbb1bce174
This method is used to change the Plan associated with an existing CodeGuard user. Only partners may perform this action, users can not change their own plan. You must specify a plan_id
attribute which represents the integer ID of a CodeGuard plan.
Note: Specifying a plan_id
that is already set for the user in question will result in a 403 (Forbidden) response.
URI: /users/<id>/plan
Method: POST
None
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X POST https://api.codeguard.com/users/48767/plan?api_key=012c513e6d309c158a19bcbc86bb7a88&plan_id=99
{
"user": {
"name":"A User",
"size":12374124,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"user@example.com",
"plan_id":99
}
}
This method is used to disable a CodeGuard user. Only partners may perform this action, users can not disable their own account. After suspension all backups will be disabled and the user will not be permitted to login.
URI: /users/<id>/suspend
Method: POST
None
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X POST https://api.codeguard.com/users/48767/suspend?api_key=012c513e6d309c158a19bcbc86bb7a88
{
"user": {
"name":"A User",
"size":12374124,
"active":false,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"user@example.com",
"plan_id":99
}
}
This method is used to re-enable a suspended CodeGuard user. Only partners may perform this action, users can not reactivate their own account. All backups will be re-enabled and the user will be permitted to login.
URI: /users/<id>/reactivate
Method: POST
None
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X POST https://api.codeguard.com/users/48767/reactivate?api_key=012c513e6d309c158a19bcbc86bb7a88
{
"user": {
"name":"A User",
"size":12374124,
"active":true,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"user@example.com",
"plan_id":99
}
}
URI: /users
Method: GET
page - The page number
per_page - The number of results per page
sort - See below
created/-created - Sort the users by their creation date
name/-name - Sort the users alphabetically by name
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X GET https://api.codeguard.com/users?api_key=012c513e6d309c158a19bcbc86bb7a88
[
{
"user": {
"name":"A User",
"size":12374124,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"user@example.com",
"plan_id":88
}
},
{
"user": {
"name":"Another User",
"size":12374124,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"another.user@example.com",
"plan_id":88
}
}]
URI: /users?search=<QUERY STRING>
Method: GET
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X GET https://api.codeguard.com/users?api_key=012c513e6d309c158a19bcbc86bb7a88?search=Another
[{
"user": {
"name":"Another User",
"size":12374124,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"another.user@example.com",
"plan_id":88
}
}]
curl -v -H "Content-type: application/json" -H "Accept: application/json" -X GET https://api.codeguard.com/users?api_key=012c513e6d309c158a19bcbc86bb7a88?search=another.user@example.com
[{
"user": {
"name":"Another User",
"size":12374124,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"another.user@example.com",
"plan_id":88
}
}]
URI: /users/<USER ID>
Method: PUT
curl -v -H "Content-type: application/json" -H "Accept: application/json" -d '{"user": {"name" : "New Name" }}' -X POST https://api.codeguard.com/users/3?api_key=012c513e6d309c158a19bcbc86bb7a88
{
"user": {
"name":"New Name",
"size":12374124,
"partner_data":"{\"package_id\":\"ppp-123456\"}",
"id":8,
"time_zone":"UTC",
"email":"user@example.com",
"plan_id":88
}
}
URI: /users
Method: POST
curl -v -H "Content-type: application/json" -H "Accept: application/json" -d '{"user": {"name" : "Test Account", "email" : "test.account@example.com", "password" : "toosimpletoguess", "password_confirmation" : "toosimpletoguess" }}' -X POST https://api.codeguard.com/users?api_key=012c513e6d309c158a19bcbc86bb7a88
{ "request": { "act": null },
"response": {
"user_email": "test.account@example.com",
"user_zone": null,
"service_url":"https://codeguard.com/" }
"result": "success",
"msg": "Your CodeGuard account has been successfully created. You will receive an email with your login information shortly."
}