Was this helpful?

 

API Platform Base Path: https://api.enterprise.apigee.com/v1

API Resource Path:

/audits/o/{org_name}

Description: Lists audit records for management operations against APIs, API revisions, and policies. (Note that base path inserts audits before organizations: /audits/organizations/{org_name}.

Verb: GET
Auth: Basic Auth
Media types:
application/json
text/xml

Overview:

For every call made to the management API, Apigee Edge logs an audit record. The /audits API enables you to obtain a record of all management calls made against entities in an organization.

By calling /audits, you can determine, for example, when an API proxy was deployed to an environment, and by whom. You can also use the audits API to retrieve the management history of OAuth tokens, enabling you to verify app end user consent.

To generate a request to the audit API, append the target resource as a URL parameter to the base path of the request for an audit.

A response from the audit API returns a history of CREATE, UPDATE, and DELETE operations on the audit target.

Supported audit targets include:

  • /apis/{api_name}
  • /apis/{api_name}/revisions/{revision_number}/policies/{policy_name}
  • /apis/{api_name}/revisions/{revision_number}/resources/{resource_name}
  • /oauth2/accesstokens
  • /oauth2/authorizationcodes
  • /oauth1/accesstokens
  • /oauth1/requesttokens
  • /developers
  • /apps
  • /apiproducts

Note that a resource name identifies a JavaScript, Python, Java, or XSLT file stored under /resources in an API proxy configuration.

To retrieve all audit records for sub-entities, use the query parameter expand=true. By setting expand=true on /apis, you return audit records for all revisions, policies, and resources for all API proxies in your organization.

The API to get the create or delete records for an API proxy is /v1/audits/o/myorg/apis/myapi.

The API to get the deploy or undeploy records for an API proxy revision is: /v1/audits/o/myorg/e/test/apis/v1/revisions/1/deployments. Note that this API is used for a specific environment. 

If you deploy an API revision, the action is recorded as a CREATE operation. If you undeploy, the action is recorded as a DELETE operation.

Sample Request:
$ curl -X GET -H "Accept:application/json" \
https://api.enterprise.apigee.com/v1/audits/o/apifactory/apiproducts?expand=true&startTime=1392258786968" \
-u myname:mypass
Query Parameters:
Name Description Default Required?
user Filters results by Apigee user's email address N/A No
operation Filters results by operation. Valid values are create, update, delete. N/A No
timeline Filters results by the specified time interval. Valid values are today, week, month. Specify either timeline, startTime, or endTime. Today No
startTime The beginning time, in milliseconds since 1 January 1970 UTC, for which audit entries should be returned. Specify either timeline, startTime, or endTime. N/A No
endTime The end time, in milliseconds since 1 January 1970 UTC, for which audit entries should be returned. Specify either timeline, startTime, or endTime. N/A No
rows A limit on the total number of audit entries to be returned when using startTime or endTime. N/A No
expand 'true' is the only valid value for this query parameter. When set to true, the audit records for all sub-resources are returned in the list of records. N/A Yes
Sample Response:
{
  "auditRecord" : [ {
    "operation" : "CREATE",
    "request" : "''apifactory''",
    "requestUri" : "/v1/o/apifactory/apiproducts",
    "responseCode" : "400",
    "timeStamp" : 1393517971158,
    "user" : "admin_user@company.com"
  }, {
    "operation" : "CREATE",
    "request" : "''apifactory''",
    "requestUri" : "/v1/o/apifactory/apiproducts",
    "responseCode" : "400",
    "timeStamp" : 1393517931524,
    "user" : "admin_user@company.com"
  }, {
    "operation" : "DELETE",
    "request" : "''apifactory''",
    "requestUri" : "/v1/o/apifactory/apiproducts",
    "responseCode" : "409",
    "timeStamp" : 1393528861053,
    "user" : "developer@company.com"
  }]
}
Response Payload Elements:
Name Description
auditRecord The audit record for an operation on the target resource
operation The operation (CREATE, UPDATE, or DELETE) logged for this target
request The target organization
requestURI The URI path of the request to the audit target
responseCode The HTTP response code returned for the operation from Apigee Edge to the requesting app
timeStamp Unix time when the action was logged by the auditing system
user The ID of the user who issued the API call in the audit record
Errors
<Error>
  <Code>audit.invalid_search_parameter</Code>
  <Message>Search parameter is not valid </Message>
  <Contexts/>
</Error>

 

Help or comments?

  • Something's not working: See Apigee Support
  • Something's wrong with the docs: Click Send Feedback in the lower right.
    (Incorrect? Unclear? Broken link? Typo?)