Announcement
Collapse
No announcement yet.
Perl-Beispiel gesucht für PUT-Request (HTTP API)
Collapse
X
-
Guest repliedkeine Ideen?
Leave a comment:
-
Guest repliedsession identifier is missing
hi. ich habe mal wieder ein session problem. hier die details:
perl-code:
Code:my $calendar_url = "http://localhost/ajax/calendar?action=all&folder=29&columns=1,200,401,100,201,202&start=0&end=1250519740000&session=" . $sid; print LOG $calendar_url . "\n"; my $req = HTTP::Request->new('GET',$calendar_url); print LOG "cookies for request: " . $ua->cookie_jar->as_string . "\n"; $ua->cookie_jar->add_cookie_header($req); my $res_cal = $ua->request($req); print LOG $res_cal->content . "\n";
output:
Code:http://localhost/ajax/calendar?action=all&folder=29&columns=1,200,401,100,201,202&start=0&end=1250519740000&session=573c80cea7424cbca72128c2b72198cf cookies for request: Set-Cookie3: JSESSIONID=a8d34fe358554196a000cbaecd6b1a09.APP1; path="/"; domain=localhost; path_spec; discard; version=0 Set-Cookie3: open-xchange-session-573c80cea7424cbca72128c2b72198cf=a2e099e1a1314b0f8feedd30861cd228; path="/"; domain=localhost; path_spec; discard; version=0 {"category":8,"error_params":[],"error":"The cookie with the session identifier is missing.","error_id":"-921994266-224","code":"SES-0202"}
Was mache ich falsch?
Ich hoffe ihr könnt mir helfen
Milchi
P.S. wie kann man main title ändern? Grund: Thema erneut geöffnet.Last edited by Guest; 08-17-2009, 04:54 PM.
Leave a comment:
-
Guest repliedFür diejenigen, die das mal brauchen sollten. Hier ist meine Lösung:
my $request_url = "http://localhost/ajax/calendar?action=new&session=" . $sid;
my $data = '{"folder_id":"'.$calid.'",
"start_date":"' . DateTime->today->subtract( days => 1 )->epoch . '000",
"end_date":"' . DateTime->today->epoch . '000",
"full_time":"true",
"shown_as":"3",
"title":"test",
"ignore_conflicts":"true"
}';
my $req_put = HTTP::Request->new( 'PUT', $request_url, undef, $data );
$req_put->header('Content-Type' => 'application/json');
$ua->cookie_jar->add_cookie_header($req_put);
my $res = $ua->request($req_put);
Leave a comment:
-
Perl-Beispiel gesucht für PUT-Request (HTTP API)
Ich habe Probleme mit dem PUT-Request der HTTP API. Ich möchte einen neuen Termin anlegen.
GET-Requests funktionieren - nur habe ich Probleme beim übergeben der Daten via PUT.
Ich verwenden HTTP::Request.
my $request_url = "http://localhost/ajax/calendar?action=new&session=" . $sid;
my $data = '{"folder_id":"$calid"}';
my $req = HTTP::Request->new('PUT',$request_url,'text/json',$data);
$ua->cookie_jar->add_cookie_header($req);
my $res = $ua->request($req);
Was mache ich falsch? Kann jemand ein Beipiel posten, wie das mit den PUT-Requests funktionieren kann?
Ich hoffe Ihr könnt mir helfen.
LG,
MilchiTags: None
Leave a comment: