Another example:
curl -u jsmith:jsmith -X POST -F “environment=TEM” -F “filename=Test” -F “[email protected]” ‘https://server.com/api/manifests’
-u jsmith:jsmith defines login and password and translated to curl.SetUserPwd(‘jsmith’, ‘jsmith’).
-F “environment=TEM” sends the data as a multipart formpost: curl.FormAdd(‘environment’, ‘TEM’).
-F “[email protected]” sends a file: curl.FormAddFile(‘multipartFile’, ‘mmabc.manifest’).
For formpost, call curl.FormPost() method instead of curl.SendRequest():
curl.Init()
!-- add form fields
cfres = curl.FormAdd('environment', 'TEM')
cfres = curl.FormAdd('filename', 'Test')
!-- add file
cfres = curl.FormAddFile('multipartFile', 'mmabc.manifest')
curl.SetUserPwd('jsmith', 'jsmith')
respfile = 'FormPost_response.txt'
res = curl.FormPost('https://server.com/api/manifests', respfile)