Quantcast
Channel: Gurock Software Support Forum - General Discussion
Viewing all articles
Browse latest Browse all 685

New API v2 migration problems

$
0
0

Hi,

I'm trying to migrate our scripts from miniapi to new v2 API.
I've found 2 problems so far. smile

1)
In miniapi we use inactive user to authorization (we got this suggestion from your support)

Now I can only access v2 API with real user and real authorization.
But this is not accepted solution.

How should we access v2 API without use real user? (we cannot create domain user for automatic tests)

2)
I got 'HTTP Error 400: Bad Request' always when I'm trying to send POST.
I use python scripts which work well for miniapi e.g.:

mydata=[('name', 'name')]
    data=urllib.urlencode(mydata)
    req = urllib2.Request(url=url, data=data, headers=properties.headerv2)
    base64string = base64.encodestring('%s:%s' % (properties.username, properties.password)).replace('\n', '')
    req.add_header("Authorization", "Basic %s" % base64string)
    response = urllib2.urlopen(req)

Testail log returns:

[BadRequestException]
---
Details: <missing>
File: /var/www/testrail/sys/helpers/ex.php
Line: 29
Status Code: 500
Host: ***********
Uri: /index.php?/api/v2/add_suite/3/ (POST)
---
Browser: Python-urllib/2.7
PHP: 5.3.10-1ubuntu3.4
Server: Linux 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64
---
Trace:
at ex::raise (ex.php:29)
at ex::raise (controller.php:184)
at Controller->_validate_get_input (controller.php:130)
at Controller->_validate (v2.php:1103)
at V2_controller->add_suite (controller.php:106)
at Controller->_invoke_web (controller.php:74)
at Controller->_invoke (gizmo.php:101)
at require_once (index.php:106)

Project with id=3 exists.
This code works well for miniapi.
I have no problem with GET methods.
Thx for help.

Regards


Viewing all articles
Browse latest Browse all 685

Trending Articles