This is a migrated thread and some comments may be shown as answers.

[API] workitems API error 500 on some tasks/stories/bugs

4 Answers 11 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 20 Sep 2015, 11:29 PM

E.g, on our system:

https://teampulse.edmi.co.nz/api/workitems/20698 - works (task)

https://teampulse.edmi.co.nz/api/workitems/20697 - error 500 (story)

https://teampulse.edmi.co.nz/api/workitems/21608 - error 500 (bug)

When it fails, the message is:

<Error>
<Message>An error has occurred.</Message>
</Error>

 All the above can be accessed in the UI

4 Answers, 1 is accepted

Sort by
0
Liliya
Telerik team
answered on 23 Sep 2015, 09:05 AM
Hi Richard,

Get tasks and Get other type of workitems have different endpoints:
GET task:
/api/tasks/<taskId>
So in your case it should be:
https://teampulse.edmi.co.nz/api/tasks/20698

GET story(or other work item type):
/api/workitems/<storyId>

Can you make sure that the item that is returned successfully is actually task with id: 20698, but not other work item type.
You can compare the ids and the URL from the UI (open dev tools with F12, and observe under Network tab) and the one in the API call, and see if there is difference in the TeamPulse link, headers, content type, authentication or itemId.

You can read more about TeamPulse API in our documentation.
Let me know if you need any further assistance.

Regards,
Liliya
Telerik
 
0
Richard
Top achievements
Rank 1
answered on 11 Oct 2015, 08:33 PM

Hi Liliya:

So:

1. I can't find any docs for the "task" API, except that "time entries" references it: http://docs.telerik.com/teampulse/developer-api-guide/Reference/Time-Entries

2. The /workitems/ API *can* access tasks, e.g. where 20866 is a task, then:
https://teampulse.edmi.co.nz/api/workitems/20866 returns what I need.

3. It cannot access stories or bugs, so for story 20865 https://teampulse.edmi.co.nz/api/workitems/20685
I get: An error has occurred

and for bug 22402 https://teampulse.edmi.co.nz/api/workitems/22402

I get: An error has occurred

(Same for features)

This seems to be the inverse of your post above.

My requirement is to take any work item id (task or bug, mostly) and find the parent/related items.

 

0
Richard
Top achievements
Rank 1
answered on 11 Oct 2015, 09:04 PM

Actually, this is an authentication issue.

I was testing by accessing the API in a browser with Teampulse logged in, and in that case, only tasks are accessible.

If I get an access token in my Java environment (without the TP session), then I can access stories. (and tasks via the workitems API)

I think the API might be more consistent and return 401 for no access though.

0
Liliya
Telerik team
answered on 13 Oct 2015, 10:06 AM
Hi,

I`m glad that you manage to find the problem.
You have point for the error code returned. We`ll consider reworking those.

Do not hesitate to contact us in case you need any further assistance.

Regards,
Liliya
Telerik
 
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Answers by
Liliya
Telerik team
Richard
Top achievements
Rank 1
Share this question
or