Closed Bug 397407 Opened 17 years ago Closed 16 years ago

XMLRPC API requires numeric IDs instead of parsing string values

Categories

(Testopia :: API, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nparrish, Assigned: gregaryh)

Details

(Whiteboard: PostgreSQL)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.5) Gecko/20070718 Fedora/2.0.0.5-1.fc7 Firefox/2.0.0.5
Build Identifier: 1.3

according to the XMLRPC API doc in the wiki (http://wiki.mozilla.org/Testopia:Documentation:XMLRPC#API_Documentation), it should be possible to specify certain fields as strings.  For example, for creation of a test run, fields like manager and environment are indicated as string values.  however, if you pass a string, you get an error (I believe from SQL) complaining about use of a string where an integer is expected.  unfortunately, numeric ids for things like manager (username) and environment are not obviously exposed by testopia; I ended up going into the underlying database and poking around the tables to find what I was looking for.  it is also possible to use other APIs, such as TestRun.lookup_environment_id_by_name, though I have not tried this yet.  

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
here is the error I get if I try to, for instance, pass an environment string instead of ID:
[nparrish@pernod testorpc]$ java createrun
org.apache.xmlrpc.XmlRpcException: DBD::Pg::db do failed: ERROR:  invalid input syntax for integer: "3node-sim"
 [for Statement "INSERT INTO test_runs (plan_id, environment_id, product_version, build_id, plan_text_version, manager_id, start_date, stop_date, summary, notes) VALUES (?,?,?,?,?,?,?,?,?,?)"] at Bugzilla/Testopia/TestRun.pm line 325
        Bugzilla::Testopia::TestRun::store('Bugzilla::Testopia::TestRun=HASH(0x9d34124)') called at Bugzilla/WebService/Testopia/TestRun.pm line 105
        Bugzilla::WebService::Testopia::TestRun::create('Bugzilla::WebService::Testopia::TestRun', 'HASH(0x9901514)') called at /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Lite.pm line 2559
        eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Lite.pm line 2547
        eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Lite.pm line 2516
        SOAP::Server::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x913...', '<?xml version="1.0"?><methodCall><methodName>TestRun.create</...') called at /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Transport/HTTP.pm line 327
        SOAP::Transport::HTTP::Server::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x913...') called at /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Transport/HTTP.pm line 423
        SOAP::Transport::HTTP::CGI::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x913...') called at /var/www/virts/bugs/bugs/tr_xmlrpc.cgi line 40

        at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeException(Unknown Source)
        at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeResponse(Unknown Source)
        at org.apache.xmlrpc.XmlRpcClientWorker.execute(Unknown Source)
        at org.apache.xmlrpc.XmlRpcClient.execute(Unknown Source)
        at org.apache.xmlrpc.XmlRpcClient.execute(Unknown Source)
        at com.sproutsys.qa.staf.TestopiaRPC.CreateRun(TestopiaRPC.java:52)
        at createrun.main(createrun.java:11)
one more thing, I am running postgres for the underlying db, not mysql.  
Whiteboard: PostgreSQL
This has been addressed in the latest checkins. Places where names are determinate such as for priority, user id, or where a case alias can be used, will now check for these. Places such as build and category which are in part determined by product will still have to do a lookup for the id first.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.