To Our Amazing Educators Everywhere,
Happy Teacher Appreciation Week!
Found this content helpful? Log in or sign up to leave a like!
Web log API process fails after running for 30 minutes with the error below. It looks like the token expires before Canvas system can deliver the data set. Once the API call to https://api-gateway.instructure.com/dap/query/canvas_logs/table/web_logs/data started, the only I can do is wait for the status to finish before processing the next step. Is there a way for extend the token expiration time? Please advise.
Thanks.
running
{
"id" : "354e23a8-0ff2-41b7-9a72-d1742e0f0c0c",
"status" : "running",
"expires_at" : "2023-12-01T14:53:35Z"
}
running
{
"id" : "354e23a8-0ff2-41b7-9a72-d1742e0f0c0c",
"status" : "failed",
"expires_at" : "2023-12-01T14:53:35Z"
}
failed
{
"id" : "354e23a8-0ff2-41b7-9a72-d1742e0f0c0c",
"status" : "failed",
"expires_at" : "2023-12-01T14:53:35Z"
}
failed
{"error":"The Token has expired on 2023-11-30T15:56:33Z."}
You can't extend the token lifetime. However, you can acquire a new token with Instructure Identity Service, following the steps in the documentation. These are the exact same steps you normally take when you first get a token before you invoke a DAP API endpoint. If you are interested in a real-life example how token renewals work, take a look at the implementation of the DAP client library, specifically at the Python module dap.api, which automatically renews expired (or about-to-expire) tokens.
From your post, it seems as if you were querying the status of or retrieving data from a failed job. Once a job reports a status of failed, no more attempts should be made to interact with it (neither status, nor data queries). Unfortunately, jobs can occasionally fail, which is the nature of asynchronous services like what DAP is. In this case, starting a new incremental query request (with the same parameters) is recommended. (Our DAP client library automatically retries jobs 3 times.) If jobs keep failing, make a note of the job ID, such that the failed job can be reported to support. If you are reporting a failed job, make sure to include as much detail as possible such that the team can investigate.
To participate in the Instructure Community, you need to sign up or log in:
Sign In