Hello,
Is it possible to get the error code of a given task via API? I mean to retrieve the same information that we get through UI Genie e.g. that the device is offline. I would like to get this for display in an external system. Any help appreciated.
Here’s a hypothetical scenario where the API returns a status code and an error message in the body:
- API Call: Get task details for ID 123
- Response Status: 400 Bad Request
- Response Body: {“message”: “Device associated with task 123 is currently offline.”}
In this example, the status code (400) indicates a bad request, and the message clarifies that the device is offline.
Remember: The specific approach depends on the API you’re using. Always refer to the official documentation for accurate details.
Thank you for your answers. I still have not been able to get the error message, however, I found in the documentation that the http code indicates whether the task was successful or if it will be completed as the device will send periodic information:
POST /devices/<device_id>/tasks?[connection_request]
Enqueue task(s) and optionally trigger a connection request to the device. Refer to Tasks section for information about the task object format. Returns status code 200 if the tasks have been successfully executed, and 202 if the tasks have been queued to be executed at the next inform.
device_id: The ID of the device.
connection_request: Indicates that a connection request will be triggered to execute the tasks immediately. Otherwise, the tasks will be queued and be processed at the next inform.
What issues are you having? I’m able to pull back the faults successfully. Ensure you are URL encoding the query.
![Screenshot 2024-06-03 at 11.49.52 AM](https://global.discourse-cdn.com/standard17/uploads/genieacs/original/2X/4/4dde46398d11a96c070d1c0d8963fb916c9bdf65.png)
Yes you are right it is possible to retrieve faults this way however in my case when I call setParameterValues I get a message in response that the device is offline and there is nothing in faults.
When I call setParameterValues via the API I get something similar in the response
Array(
[name] => setParameterValues
[parameterValues] => Array()
[device] => “”
[timestamp] => 2024-06-04T07:38:14.292Z
[_id] => 665ec4660bf1b36d21d15c78
[http_code] => 202
)
and there is nothing in faults either and in that case only the http code tells me if the task has completed or will be completed during the periodic inform.
GenieACS is working exactly as intended. HTTP code 202 means the task was accepted and queued by GenieACS. There is no status code to return from the CPE because the CPE is offline.