in reply to how to post an xml using REST::Client
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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to post an xml using REST::Client
by KSHYAMKUMAR (Acolyte) on Apr 07, 2016 at 21:53 UTC | |
|
Re^2: how to post an xml using REST::Client
by 1nickt (Canon) on Apr 08, 2016 at 19:53 UTC | |
by KSHYAMKUMAR (Acolyte) on Apr 08, 2016 at 20:15 UTC | |
by 1nickt (Canon) on Apr 08, 2016 at 20:46 UTC | |
|
Re^2: how to post an xml using REST::Client
by KSHYAMKUMAR (Acolyte) on Apr 07, 2016 at 21:57 UTC | |
by spazm (Monk) on Apr 07, 2016 at 22:19 UTC | |
by KSHYAMKUMAR (Acolyte) on Apr 08, 2016 at 01:49 UTC |