Upload d'un attachment vers le serveur avec l'API Rest

leo.frances
Messages : 2
Inscription : lun. nov. 05, 2018 9:32 am

Upload d'un attachment vers le serveur avec l'API Rest

Message par leo.frances »

Bonjour,

Nous essayons de créer un attachment sur un projet en envoyant son contenu.

Voici la requête envoyé :

POST /api/rest/latest/projects/1/attachments HTTP/1.1

Content-Type: multipart/form-data; boundary=6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Accept: application/json
Host: localhost:8080

--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Content-Disposition: form-data; name=files
Content-Type: application/pdf

du texte
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Content-Disposition: form-data; name=files
Content-Type: application/pdf

encore du texte
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm--


Le code HTTP renvoyé dans la réponse est bien 201, mais rien n'est créé sur le serveur.

La réponse du serveur :

Status code: 201
Header:
Transfer-Encoding: chunked
X-Frame-Options: DENY
null: HTTP/1.1 201
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID=5E7C58BBB3F76A8BDC8989C0D81FDF15; Path=/squash; HttpOnlyExpires: 0Pragma: no-cacheX-
XSS-Protection: 1; mode=block
X-Application-Context: application,squash.tm.cfg:h2:8080Date: Mon, 05 Nov 2018 10:26:01 GMT
Content-Type: application/json;charset=UTF-8
Response data: { }


Avez-vous une solution ?

Sincères salutations
laurent.michenaud
Messages : 5
Inscription : mar. juin 04, 2019 2:01 pm

Re: Upload d'un attachment vers le serveur avec l'API Rest

Message par laurent.michenaud »

Bonjour,

Si cela peut aider, cette commande curl fonctionne chez nous pour l'upload :

Code : Tout sélectionner

curl -X POST \
  http://localhost:8090/squash/api/rest/latest/execution-steps/63/attachments/ \
  -H 'Postman-Token: d31bccd4-3e59-482a-a390-b072f2153a93' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'files
=@/Users/*****/Downloads/220px-Tux.svg.png'
Répondre

Revenir à « API Rest Test Management »