Dear Centreon Community members,
I'm struggling with the centreon API usage for a specific task: "setting a downtime"
1. I'm able to use the basic auth to get a token
1. use this token to do several API calls like checking the API version, get host id, etc.
1. BUT when I try to set a downtime for a specific host it does work and I received a 403 ; *(For test purpose the user as received admin privileges)*
To give you more details and to let you preproduce the issue I encountered, please find some curl commands below:
- get host information: OK
```bash
curl -k -H "Content-Type: application/json" -H "centreon-auth-token: XXXXXXXXXXXXXX" -X GET "https://centreon.srv.domain/centreon/api/index.php?object=centreon_realtime_hosts&action=list&search=myserver03&fields=id,name,alias,address"
```
- answer received:
```javascript
t{"id":2348,"name":"MYERVER03","alias":"MYERVER03","address":"1.222.111.23"}]
```
2. set a downtime: NOK
```javascript
curl -k -H "Content-Type: application/json" -H "centreon-auth-token: XXXXXXXXXXXXXX" -X POST "https://centreon.srv.domain:443/centreon/api/monitoring/hosts/2348/downtimes" -d '{
"author_id": 3,
"comment": "Downtime set by ITPA",
"duration": 3600,
"end_time": "2023-11-29T10:38:34Z",
"is_fixed": true,
"start_time": "2023-11-29T10:23:34Z",
"with_services": true
}'
```
- answer received:
```html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
</body></html>
```
> I received a 403 fordidden BUT I suspect something no properly formatted like the date format in by request body.
Any idea what's wrong here ?
Thanks in advance for your time and help.
ps: The official documentation is available here: Centreon Web RestAPI