So you want to translate this curl command into Rest::Client code, right?
should look something like:curl -X POST \ -H "Content-Type: multipart/form-data" \ -H "ABC_APP_ID: <Application_ID>" \ -H "IABC_APP_PASSWORD: <Application_Password>" \ -F "deliverable_file=@sample.xml" \ -F "data_transaction_code=SOA" \ -F "file_name=RRR-xxxxxxxxxx.mmddyyyy-hhmmss.ext" \ -F "agency_task_order_parameter=12345667890" \ -F "contractor_service_request_number=123456780123456789" \ -F "deliverable_type=Notification" \ -F "data_transaction_file_date=2016-01-21" \ -F "tags=\"tagSample1\", \"tagSample2\"" \ "http://<server>:<port>/cdx/abc/gsa/deliverables"
Note: edited to remove the major code errors#!/usr/bin/perl use strict; use warnings; use REST::Client; my $server = 'localhost'; my $port = '7999'; my $path = '/cdx/abc/gsa/deliverables'; my $application_id = '...'; my $application_password = '...'; my %fields = ( deliverable_file => "sample.xml", data_transaction_code => "SOA", file_name => "RRR-xxxxxxxxxx.mmddyyyy-hhmmss +.ext", agency_task_order_parameter => "12345667890", contractor_service_request_number => "123456780123456789" , deliverable_type => "Notification", data_transaction_file_date => "2016-01-21", tags => ["tagSample1", "tagSample2"] ); my $url = "http://$server:$port/cdx/abc/gsa/deliverables"; my $client = REST::Client->new({host => $url}); # add the headers '-H' lines $client->addHeader('ABC_APP_ID', $application_id); $client->addHeader('IABC_APP_PASSWORD', $application_password); # add the fields '-F' lines my $get_query = $client->buildQuery(%fields); #this doesn't help for +POST $client->POST($url);
In reply to Re: how to post an xml using REST::Client
by spazm
in thread how to post an xml using REST::Client
by KSHYAMKUMAR
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |