Cannot Parse Inputstream Due To I/o Error As Json Document
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up RallyDev: Unable to create defect. Server says “Cannot parse input …” up vote 3 down vote favorite Original Post: I'm trying to create defects programmatically. I am getting a couple errors and having trouble getting any further. Here, essentially, is the code: import requests, json rally_auth = ('my_user', 'my_pw') rally_auth_url = 'https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize' rally_defect = 'https://rally1.rallydev.com/slm/webservice/v2.0/defect/defect' workspace_ref = 'https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12345' fe_project_ref = 'https://rally1.rallydev.com/slm/webservice/v2.0/project/7890' current_fe_release_ref = "https://rally1.rallydev.com/slm/webservice/v2.0/release/45678" r = requests.get(rally_auth_url, auth=rally_auth) token = r.json()['OperationResult']['SecurityToken'] url = rally_defect + '/create?key=' + token payload = { 'Name': 'My defect', 'State': 'Open', 'Project': fe_project_ref, 'Rank': 120, 'Release': current_fe_release_ref, 'key': token } headers = {'content-type': 'application/json'} r = requests.post(url, data=json.dumps(payload), auth=rally_auth, headers=headers) You'll notice that i've put the token in both the POST's URL and data. The API docs say that I should have the key in the URL, but if I do not include the key in the POST data I get: {"CreateResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": ["Not authorized to perform action: Invalid key"], "Warnings": []}} If I do include the key, the API request falls over differently. It will fail on the first comma. {"CreateResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": ["Cannot parse input stream due to I/O error as JSON document: Parse error: expected '}' but saw ',' [ chars read = >>>{\"Name\": \"My defect\",<<< ]"], "Warnings": []}} I am baffled. Fixed code Thanks to @nickm import requests, json rally_auth = ('my_user', 'my_pw') rally_auth_url = 'https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize' rally_defect = 'https://rally1.rallydev.com/slm/webservice/v2.0/defect/defe
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Rally http://stackoverflow.com/questions/22573359/rallydev-unable-to-create-defect-server-says-cannot-parse-input Test case result update using Rest API up vote 2 down vote favorite 1 There is a Rest Webservice URI for Test case result update in Rally. https://rally1.rallydev.com/slm/webservice/v2.0/testcaseresult/create Can some one tell me what should be the payload for this? May be point me to a working example. I have searched this a lot for 2 days and could not find the information what http://stackoverflow.com/questions/26979217/rally-test-case-result-update-using-rest-api I want. The closest is: Rally add test case results in bulk using web services API But however this did not help too.. java web-services rest testing rally share|improve this question asked Nov 17 '14 at 18:19 Mike 24821633 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote What is your payload? What is the error you receive? The post you refer to was correct for previous versions of WS API. v2.0 does not support XML, only JSON. Minimally, the following fields must be set in the payload "{"TestCaseResult":{"Build":"1","Date":"2014-09-04T19:56:05.000Z","TestCase":"/testcase/12358743669","Verdict":"Pass"}}" Here is a full curl example. where double quotes are being escaped on Windows: curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"TestCaseResult\":{\"Build\":\"1.0\",\"TestCase\":\"/testcase/12358743669\",\"Date\":\"2014-09-04T19:56:05.000Z\",\"Verdict\":\"Pass\"}}" https://rally1.rallydev.com/slm/webservice/v2.0/TestCaseResult/create Since you used a java tag in your post, here is an example based on Rally Java toolkit. public class addTCRtoTC { public static void main(String[] args) throws URISyntaxException, IOException { String host = "https://rally1.rallydev.com"; String username = "user@co.com"; String password = "secret"; String wsapiVersion = "v2.0"; String projectRef = "/project/2222"; String workspaceRef = "/workspace/11111"; String applicationName = "RestExample_AddTCR"; RallyRestApi restApi = new RallyRestApi( new URI(host), username, password); restApi.setWsapiVersion(wsapiVersion); restApi.setApplicationName(applicationName); //Read User QueryReq
from GoogleSign inHidden fieldsSearch for groups or messages