Examples
This section describes how to call APIs to create a log group.
The token obtained from Identity and Access Management (IAM) is valid for only 24 hours. If you want to use one token for authentication, you can cache it to avoid frequently obtaining the token.
Involved APIs
For token authentication, you must obtain a token and add the X-Auth-Token request header when calling APIs.
- IAM API used to obtain the token
- API used to create a log group
Procedure
- Obtain the token by following instructions in Obtaining Request Authentication Information.
- Send POST /v2.0/{project_id}/log-groups.
- Add Content-Type and X-Auth-Token to the request header.
- Specify the following parameters in the request body:
POST /v2.0/{project_id}/log-groups { "log_group_name":"test001", //Log group name (mandatory, String) "ttl_in_days":"7", // log expiration time (default, int) }After the request is successfully processed, information about the created tracker is returned.
{ "log_group_id":"2a0089e4-3001-11e9-9e9d-286ed488ce71", //log group ID (String) }If the request fails, an error code and error description are returned. For details, see Error Code.
Last Article: Obtaining Account and Project IDs
Next Article: API Description
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.