I installed ONLYOFFICE for testing via GitHub - ONLYOFFICE/Docker-CommunityServer: Collaborative system for managing documents, projects, customer relations and emails in one place. I started docker-compose.workspace.yml
.
I want to test the API v2:
I retrieve a token with:
curl --request POST --header "Content-Type: application/json" --data '{"username":"user","password":"password"}' "http://server/api/2.0/authentication.json"
Then I use it in the request:
curl -I --request GET --header "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: XXXXXX" "http://server/api/2.0/people"
J’obtient
HTTP/1.1 401 Unauthorized
Server: nginx/1.22.0
Date: Fri, 07 Jun 2024 13:59:06 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 12
Connection: keep-alive
WWW-Authenticate: Basic Realm="server"
X-AspNet-Version: 4.0.30319
Cache-Control: private
In one command:
curl -I --request GET --header "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: $(curl --request POST --header "Content-Type: application/json" --data '{"username":"user@mail.com","password":"password"}' "http://server/api/2.0/authentication.json" -s | jq .response.token)" "http://server/api/2.0/people"