question

kmd6076 avatar image
kmd6076 asked ericnute edited

How can I upload a file using REST session?

What are the steps to upload a file using the REST session?
iTestrest
3 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ericnute avatar image ericnute commented ·
Can you provide more detail about your question? Which product are you using? Are you trying to run a test of a device's ability to receive files? What have you tried already, and what was the result?
0 Likes 0 ·
kmd6076 avatar image kmd6076 commented ·
I'm using iTest 4.1 on Ubuntu 12.04 (not the officially supported version for Linux iTest) and I'm trying to upload a file to a server that supports the REST API but can't figure out how to specify the file for upload. The intent is for another device to download this file later in a separate test. II have setup/used the REST session with success but not for uploading files, only for Puts/Posts/Deletes. Does iTest Rest session support uploading files?
0 Likes 0 ·
Yaseen avatar image Yaseen ♦ commented ·
Could you please share with us the REST API syntax/command that you could use outside the iTest to perform the same.
0 Likes 0 ·

1 Answer

·
Yaseen avatar image
Yaseen answered ericnute edited
We need to specify the respective content-type as HTTP header and paste the content of file in a Raw section of session window, with the respective API and method as POST For example: To upload the file which contains xml data, the command in curl involves, curl --request POST --basic --user admin:admin --header "Content-Type:application/xml" --data-binary @C:/Users/DELL/Desktop/sample123.tbml http://xx.xx.xx.xx/ilo/api/0/topology/upload_tbml For the same action to make it work in iTest REST session, I specified the URL as http://xx.xx.xx.xx/ilo/api/0/topology/upload_tbml then HTTP header as content-Type, application/xml and pasted the xml file contents in raw field as shown below, Hope this helps! ![alt text][1] ![alt text][2] [1]: /storage/temp/3756-httpheader.jpg [2]: /storage/temp/3757-raw.jpg

httpheader.jpg (40.2 KiB)
raw.jpg (73.1 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.