Skip to content

Issue passing id to get_task() #9

@gstraderbgl

Description

@gstraderbgl

I am making a call like this where the task_id is a GUID such as 3bc13721-d21c-47b7-b99b-da05cd91b8d0.

task = qrs.get_task(filterparam="id eq", filtervalue=task_id)

I receive a runtime error as follows.
File "C:\software\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Debugging the script, I see that session.get() is called on line 137 of qrspy.py, and a request is made to the server. The response that is returned is a 400 error:
b'Cannot convert the constant value "Guid" to the following: '3bc13721-d21c-47b7-b99b-da05cd91b8d0''

In reviewing the QRS API documentation, it appears that you're not supposed to quote GUIDs. I removed the single quotes around {3} on line 137 of qrspy.py, and the request to the API returns the correct results. Is this a bug or am I doing it wrong? In your examples only name parameters are passed, not GUIDs.

Non-working code for GUIDs:
Line 137: response = session.get("https://{0}/{1}?filter={2} '{3}'&xrfkey={4}".format

Non-working example request for GUIDs:
"https://bgl-gs-w540:4242/qrs/task?filter=id%20eq%20'3bc13721-d21c-47b7-b99b-da05cd91b8d0'&xrfkey=2W8Ia1QjtfK6C9XU"

Working code for GUIDs:
response = session.get("https://{0}/{1}?filter={2} {3}&xrfkey={4}".format

Working example request for GUIDs:
'https://bgl-gs-w540:4242/qrs/task?filter=id%20eq%203bc13721-d21c-47b7-b99b-da05cd91b8d0&xrfkey=ysk4tEJbah3MpSjU'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions