danmunn/redmine_dmsf

API - Upload a document into a given folder or the root folder

Closed this issue · 1 comments

Hello,
I'd like to know if the formalism was up to date on the wiki or if I've forgotten something.

Req:

curl -X POST --data-binary "@Copie.png" "https://mon.redmine.com/projects/phb/dmsf/upload.xml?filename=Copie.png" \                                                   
  -H "Content-Type: application/octet-stream" \
  -H "X-Redmine-API-Key: azertyuiopqsdfghjklmwxcvbn"

Response :

<?xml version="1.0" encoding="UTF-8"?><upload><token>2754.9d8c5c00dced6816e9787a4fa0122330eb24072cdb232187244357bb28e9ab5c</token></upload>% 

Req:

curl -X POST --data "@test.xml" "https://mon.redmine.com/projects/phb/dmsf/commit.xml" \                                                                               
  -H "Content-Type: application/xml" \         
  -H "X-Redmine-API-Key: azertyuiopqsdfghjklmwxcvbn"

Response

<?xml version="1.0" encoding="UTF-8"?><dmsf_files total_count="0" type="array"></dmsf_files>%   

it's like I'm using the wrong token every time.

this is my test.xml:

<?xml version="1.0" encoding="utf-8" ?>
<attachements>
 <uploaded_file>
  <name>Copie.png</name>
  <title>mobilité_copie</title>
  <description>Image prise depuis l'application mobile</description>
  <token>2754.9d8c5c00dced6816e9787a4fa0122330eb24072cdb232187244357bb28e9ab5c</token>
 </uploaded_file>
</attachements>

This is the log of redmine

I, [2024-09-09T09:55:01.614797 #13275]  INFO -- : [2c89b63f-d637-44b0-bf9e-c368a6e4fed1] Started POST "/projects/phb/dmsf/upload.xml?filename=Copie.png" for 185.91.220.175 at 2024-09-09 09:55:01 +0000
I, [2024-09-09T09:55:01.615600 #13275]  INFO -- : [2c89b63f-d637-44b0-bf9e-c368a6e4fed1] Processing by DmsfUploadController#upload as XML
I, [2024-09-09T09:55:01.615632 #13275]  INFO -- : [2c89b63f-d637-44b0-bf9e-c368a6e4fed1]   Parameters: {"filename"=>"Copie.png", "id"=>"phb"}
I, [2024-09-09T09:55:01.617887 #13275]  INFO -- : [2c89b63f-d637-44b0-bf9e-c368a6e4fed1]   Current user: admin (id=1)
I, [2024-09-09T09:55:01.618888 #13275]  INFO -- : [2c89b63f-d637-44b0-bf9e-c368a6e4fed1] Saving attachment '/opt/redmine/files/2024/09/240909095501_Copie.png' (139248 bytes)
I, [2024-09-09T09:55:01.634379 #13275]  INFO -- : [2c89b63f-d637-44b0-bf9e-c368a6e4fed1]   Rendered plugins/redmine_dmsf/app/views/dmsf_upload/upload.api.rsb (Duration: 0.3ms | Allocations: 126)
I, [2024-09-09T09:55:01.634702 #13275]  INFO -- : [2c89b63f-d637-44b0-bf9e-c368a6e4fed1] Completed 201 Created in 19ms (Views: 1.0ms | ActiveRecord: 14.6ms | Allocations: 1686)
I, [2024-09-09T09:55:51.839744 #13275]  INFO -- : [4bbcacdb-4ecc-418e-8264-dc9c18be9a54] Started POST "/projects/phb/dmsf/commit.xml" for 185.91.220.175 at 2024-09-09 09:55:51 +0000
I, [2024-09-09T09:55:51.842449 #13275]  INFO -- : [4bbcacdb-4ecc-418e-8264-dc9c18be9a54] Processing by DmsfUploadController#commit as XML
I, [2024-09-09T09:55:51.842585 #13275]  INFO -- : [4bbcacdb-4ecc-418e-8264-dc9c18be9a54]   Parameters: {"attachements"=>{"uploaded_file"=>{"name"=>"Copie.png", "title"=>"mobilité_copie", "description"=>"Image prise depuis l'application mobile", "token"=>"2754.9d8c5c00dced6816e9787a4fa0122330eb24072cdb232187244357bb28e9ab5c"}}, "id"=>"phb"}
I, [2024-09-09T09:55:51.845457 #13275]  INFO -- : [4bbcacdb-4ecc-418e-8264-dc9c18be9a54]   Current user: admin (id=1)
I, [2024-09-09T09:55:51.849732 #13275]  INFO -- : [4bbcacdb-4ecc-418e-8264-dc9c18be9a54]   Rendered plugins/redmine_dmsf/app/views/dmsf_upload/commit.api.rsb (Duration: 0.4ms | Allocations: 140)
I, [2024-09-09T09:55:51.852614 #13275]  INFO -- : [4bbcacdb-4ecc-418e-8264-dc9c18be9a54] Completed 200 OK in 10ms (Views: 1.0ms | ActiveRecord: 1.5ms | Allocations: 2591)

ok sorry i can't read, illiterate french mistake. i spelled attachments wrong