03-09-2017 05:46 AM
I use community edition and ı want to try alfresco rest api on postman. But ı get 401 unauthorize message while trying rest api. I think, it wants a token . But ı dont know how can ı token locally. Thanks.
03-09-2017 09:55 AM
In postman: (note that I am using Alfresco CE 201702, but this should work back to 5.0)
Set the URL to http(s)://hostort/alfresco/api/-default-/public/authentication/versions/1/tickets
Leave the Authorization tab blank
In the 'Body' tab, change the data type to 'raw' and select JSON (application/json) from the dropdown
In the body enter:
{
"userId": "yourusernamehere",
"password": "passwordinplaintext"
}
Hit send..
I should note that I am not using the tickets feature in my REST API calls. I am adding basic auth headers to all requests. If you want to go that route just enter your username/password in the Authorization table and click Update Request. That will add a new header to the HTTP request containing your username/password.
Finally, the API-explorer add-on is wonderful. I deployed it on my test server and you can try out all the REST APIs without having to use Postman. You have to build it yourself, but it is IMHO worth the time to do.
GitHub - Alfresco/rest-api-explorer: Public REST API Explorer
03-09-2017 09:55 AM
In postman: (note that I am using Alfresco CE 201702, but this should work back to 5.0)
Set the URL to http(s)://hostort/alfresco/api/-default-/public/authentication/versions/1/tickets
Leave the Authorization tab blank
In the 'Body' tab, change the data type to 'raw' and select JSON (application/json) from the dropdown
In the body enter:
{
"userId": "yourusernamehere",
"password": "passwordinplaintext"
}
Hit send..
I should note that I am not using the tickets feature in my REST API calls. I am adding basic auth headers to all requests. If you want to go that route just enter your username/password in the Authorization table and click Update Request. That will add a new header to the HTTP request containing your username/password.
Finally, the API-explorer add-on is wonderful. I deployed it on my test server and you can try out all the REST APIs without having to use Postman. You have to build it yourself, but it is IMHO worth the time to do.
GitHub - Alfresco/rest-api-explorer: Public REST API Explorer
03-11-2017 03:28 AM
Thank you your answer. It runs successfully. I want to write in detail for help to encounter like my problem.
I pass usernameassword(But base64 encoded) Authorization field in header and it works without error.
Thank you again.
Explore our Alfresco products with the links below. Use labels to filter content by product module.