MarvinHorst Posted October 17, 2022 Report Share Posted October 17, 2022 I have been sucessful using the REST Api for accessing information already loaded in Daminion. I'm attempting to upload a file into the repository and I receive the following reply. {"message":"Authorization has been denied for this request."} The user account being used has the Admin role. Is there more documentation on how to upload a file? Perhaps I need a destination path or something. Quote Link to comment Share on other sites More sharing options...
Oleg.Ross Posted October 18, 2022 Report Share Posted October 18, 2022 Hello,@MarvinHorst. Could you please give me some more information: Describe your import scenario. We have several import mechanisms, so you need to know exactly what you want. What do you use to make requests ? Quote Is there more documentation on how to upload a file? Unfortunately, no. We are supplementing the documentation, depending on what users ask for. This is currently the first request. Best regards, Oleg. Quote Link to comment Share on other sites More sharing options...
MarvinHorst Posted October 18, 2022 Author Report Share Posted October 18, 2022 Our users have been using the web client to copy images to the local folder on the Daminion Server. I'm attempting to upload a file to the local folder on the server using a REST call via the API and CURL. Perhaps this has something to do with it? Also I see the API Enabled is set to No. My other REST calls are working fine. What is this? Thanks! Quote Link to comment Share on other sites More sharing options...
Oleg.Ross Posted October 19, 2022 Report Share Posted October 19, 2022 @MarvinHorst Run the panel under the same user that is running the server.Check if the path specified in the directory settings is available. But I don't think that's the problem. Otherwise users would not be able to upload their files. Quote Also I see the API Enabled is set to No. My other REST calls are working fine. What is this? This is an old API, we don't use it right now. HOW-TO Upload files: 1. First at all, we need to get authorization: curl -X POST '{CATALOG_URL}/account/login' -H 'Content-Type: application/json' --data-raw '{ "usernameOrEmailAddress": "{USERNAME}", "password": "{PASSWORD}" }' Windows example: curl -v -X POST (CATALOG-URL)/account/login -H "Content-Type:application/json" --data {\"usernameOrEmailAddress\":\"admin\",\"password\":\"admin\"}" Response: POST /daminion/account/login HTTP/1.1 > Host: 192.168.88.22 > User-Agent: curl/7.83.1 > Accept: */* > Content-Type:application/json > Content-Length: 53 > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Cache-Control: private < Pragma: no-cache < Content-Type: application/json; charset=utf-8 < Expires: -1 < Server: Microsoft-IIS/10.0 < Set-Cookie: .ASPXANONYMOUS=RyL-3gxQx5JAIb4eRNXzLvWb0ysgctmvLrNF8aGM-ssJ3X7ry6tcSCmBbHGekGR42YIXFL_yqRCuZYTUMPHKYJymFBcOX4FZQAgp9qnxRWACAfEON4UTiHYhGFvF6UbINcFeFwW5gOlUNegVPzhzUQ2; expires=Tue, 27-Dec-2022 23:53:02 GMT; path=/; HttpOnly < Set-Cookie: ASP.NET_SessionId=luoybotwqf1pxw1zouhuqfje; path=/; HttpOnly; SameSite=Lax < X-AspNetMvc-Version: 5.2 < Access-Control-Allow-Credentials: true < X-AspNet-Version: 4.0.30319 < Set-Cookie: .AspNet.ApplicationCookie=Zt9ei-vz0vZenuKc4OwWOgKao30i1jNiazTBwxGUTWpTnheBhjAJEAXgRaku9iz31EsRT0SwJSyhzQ36r-GgDCWCZzBHTXP9KtJ48vtkPK_wuCLhrQcU0pgR9kLAE17-Ko3ruU-dnZOsAMlz-MPfQf-qg_CapP_00S5SNDZoXK3LonEpIB0NRy9IpnzHYD_2Gl7wVA4sd0i_r7J1wa0QkpKnn2oBF6MPFJlkRD51moEhqJUHDn8Qfgrp3P1yg5FDz0IYwvg3_Fh6ldwoUgHIb--zwo_DBCgKfEpYDZCvLU6vZHowi6gRGIrH4TuK73m3nyW_NfiAKNstjxbyyQ6eD9lKJwhJ5LpGp20lq6KXv56NaOjhRgZ4uokGzVPEAKCmATPAtAL7ISe4hE-z1GFeEQ; path=/; HttpOnly < X-Powered-By: ASP.NET < Date: Wed, 19 Oct 2022 13:13:02 GMT < Content-Length: 68 Cookie: .AspNet.ApplicationCookie=Zt9ei-vz0vZenuKc4OwWOgKao30i1jNiazTBwxGUTWpTnheBhjAJEAXgRaku9iz31EsRT0SwJSyhzQ36r-GgDCWCZzBHTXP9KtJ48vtkPK_wuCLhrQcU0pgR9kLAE17-Ko3ruU-dnZOsAMlz-MPfQf-qg_CapP_00S5SNDZoXK3LonEpIB0NRy9IpnzHYD_2Gl7wVA4sd0i_r7J1wa0QkpKnn2oBF6MPFJlkRD51moEhqJUHDn8Qfgrp3P1yg5FDz0IYwvg3_Fh6ldwoUgHIb--zwo_DBCgKfEpYDZCvLU6vZHowi6gRGIrH4TuK73m3nyW_NfiAKNstjxbyyQ6eD9lKJwhJ5LpGp20lq6KXv56NaOjhRgZ4uokGzVPEAKCmATPAtAL7ISe4hE-z1GFeEQ 2. Import file: curl -X POST '{CATALOG_URL}/api/import/uploadFile' -H 'Cookie: .AspNet.ApplicationCookie={AUTHENTICATION_COOKIE}' -F 'file=@"{PATH_TO_FILE}"' Windows sample: curl -X POST http://192.168.XX.XX/daminion/api/import/uploadFile --cookie ".AspNet.ApplicationCookie=Zt9ei-vz0vZenuKc4OwWOgKao30i1jNiazTBwxGUTWpTnheBhjAJEAXgRaku9iz31EsRT0SwJSyhzQ36r-GgDCWCZzBHTXP9KtJ48vtkPK_wuCLhrQcU0pgR9kLAE17-Ko3ruU-dnZOsAMlz-MPfQf-qg_CapP_00S5SNDZoXK3LonEpIB0NRy9IpnzHYD_2Gl7wVA4sd0i_r7J1wa0QkpKnn2oBF6MPFJlkRD51moEhqJUHDn8Qfgrp3P1yg5FDz0IYwvg3_Fh6ldwoUgHIb--zwo_DBCgKfEpYDZCvLU6vZHowi6gRGIrH4TuK73m3nyW_NfiAKNstjxbyyQ6eD9lKJwhJ5LpGp20lq6KXv56NaOjhRgZ4uokGzVPEAKCmATPAtAL7ISe4hE-z1GFeEQ" -F file=@"C:\Users\Oleg\Documents/3.png" Response file GUID: "9021d5ce-8719-4ece-bf01-295476d3820b" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.