Skip to content

Instantly share code, notes, and snippets.

@clrh
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save clrh/e9bcefb438ad4508d5a9 to your computer and use it in GitHub Desktop.

Select an option

Save clrh/e9bcefb438ad4508d5a9 to your computer and use it in GitHub Desktop.
Redmine::API error for PUT (wsod)
$ curl -d "{'issue': {'story_points' : 13} }" -D - -XPUT http://sbox-forge/issues/12789.json -H "Content-Type: application/json" &> 1.out
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 707 100 674 100 33 8771 429 --:--:-- --:--:-- --:--:-- 32095
HTTP/1.1 500 Internal Server Error
Date: Wed, 02 Jul 2014 14:05:39 GMT
Server: Apache/2.2.15 (CentOS)
X-Request-Id: 181c72ca259f4958179bbacf5e274d9f
X-Runtime: 0.001867
X-Rack-Cache: invalidate, pass
X-Powered-By: Phusion Passenger 4.0.37
Content-Length: 674
Status: 500 Internal Server Error
Content-Type: text/html; charset=utf-8
Connection: close
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>Redmine 500 error</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
margin:10px;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
</style>
<body>
<h1>Internal error</h1>
<p>An error occurred on the page you were trying to access.<br />
If you continue to experience problems please contact your Redmine administrator for assistance.</p>
<p>If you are the Redmine administrator, check your log files for details about the error.</p>
<p><a href="javascript:history.back()">Back</a></p>
</body>
</html>
$ perl forge-setestimation.pl
forge_estimation.csv at forge-setestimation.pl line 20.
rf: 14534 ; estim:1
issues/12789.json at /usr/local/share/perl/5.14.2/Redmine/API/Action.pm line 78, <FD> line 1.
{
issue => {
author => { id => 260, name => "chernandez" },
created_on => "2014-03-28T13:26:03Z",
custom_fields => [
{ id => 5, name => "Priorit\xE9 client", value => "Normale" },
{ id => 11, name => "Phase", value => "" },
{ id => 13, name => "Mois", value => "" },
{ id => 8, name => "Sem", value => "" },
{ id => 6, name => "Budget", value => "" },
{ id => 1, name => "Client", value => "" },
{ id => 15, name => "Date limite de r\xE9alisation", value => "" },
{ id => 44, name => "Iceberg", value => "" },
],
description => "",
done_ratio => 10,
estimated_hours => 4,
id => 12789,
priority => { id => 4, name => "Normal" },
project => { id => 56, name => "AFI-OPAC 2.0 V3" },
spent_hours => 0,
start_date => "2014-03-28",
status => { id => 14, name => "A planifier" },
story_points => 5,
subject => "En tant que <>... test",
tracker => { id => 2, name => "D\xE9veloppement" },
updated_on => "2014-07-02T13:06:34Z",
},
}
issues/12789.json at /usr/local/share/perl/5.14.2/Redmine/API/Action.pm line 78, <FD> line 1.
AVT:5
issue at /usr/local/share/perl/5.14.2/Redmine/API/Action.pm line 100, <FD> line 1.
$VAR1 = {
'story_points' => 20
};
at /usr/local/share/perl/5.14.2/Redmine/API/Action.pm line 125, <FD> line 1.
malformed JSON string, neither array, object, number, string or atom, at character offset 1 (before "(end of string)") at /usr/local/share/perl/5.14.2/Redmine/API/Action.pm line 124, <FD> line 1.
Bad JSON format : at forge-setestimation.pl line 44.
#!/usr/bin/perl
use Modern::Perl;
use Redmine::API;
use Data::Dump qw/dump/;
use Data::Dumper;
use Config::YAML;
my $conf = Config::YAML->new( config => "myforge.yaml");
my $client = Redmine::API->new(
'auth_key' => $conf->get_key
, base_url => $conf->get_base_url
, trace => 1);
my $file = $conf->get_numlist;
my $estim;
my $redmine_number;
my $line;
warn $file;
open(FD, $file) or say "Error: '$file' $!" and next;
while ( my $line = <FD> ) {
my @values = split (";", $line);
$estim = $values[0];
$redmine_number = $values[1];
chomp $redmine_number;
print "rf:$redmine_number ; estim:$estim\n";
}
my $rf = 12789; #sbox
say dump $client->issues->issue->get($rf);
say "AVT:" . $client->issues->issue->get($rf)->{'issue'}->{'story_points'};
$client->issues->issue->update($rf, story_points => 20);
say "APRES:" . $client->issues->issue->get($rf)->{'issue'}->{'story_points'};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment