Support

Expand all | Collapse all

JAMA REST API "/comments" JAVA.NullPointerException

  • 1.  JAMA REST API "/comments" JAVA.NullPointerException

    Posted 09-19-2018 14:07
    Hi!

    I hope this finds you well. I am trying to use the REST API in to help my team automate some tasks. I decided to start exploring the API with comments since they are generally harmless and they have the first functionality that I wanted to tests, GET and POST. Everything works fine for my GET methods, but not for my post. I seem to either get a java.NullPointerException or a "Unrecognized token 'inReplyTo'".

    After trying multiple ways with python, I decided to try the curl example provided in the documentation. After doing the authentication dance and getting the correct token (because that was not working well from that page either about a week ago) I still get the java.lang.NullPointerException. Here is the whole thing with the token redacted:

    curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer xxxxxxxxxx' -d '{"inReplyTo": 0,"body": {"text": "Jean Curl Test"},"commentType": "GENERAL","location": {"item": 144552,"project": 37}}' 'https://nextev-dev.jamacloud.com/rest/latest/comments'

    {"meta":{"status":"Internal Server Error","timestamp":"2018-09-19T20:08:33.729+0000","message":"","exception":{"class":"java.lang.NullPointerException","message":null}}}

    Here is a snippet from the API-Docs Page:

    Is there something that I am missing in here? Can someone help me out? Thanks!

    Sincerely,

    ------------------------------
    Jean Torres
    NIO
    San Jose CA
    7873154690
    ------------------------------


  • 2.  RE: JAMA REST API "/comments" JAVA.NullPointerException

    Posted 09-19-2018 16:04
    Jean,
    That error looks like an issue in Jama where API requests were failing because a user didn't have an 'active project' assigned to them. This 'active project' corresponds to whatever you select in the project popup when you first log in; oftentimes users will create an API/integrations account, and don't ever log it in and open Jama items via the UI. This is a reasonable thing to do, and we did fix the defect after figuring out what was going wrong, but it's still present in earlier versions of Jama. Have you tried logging in as the user you're using for your integration, selecting a project, then opening a couple items? I think that should make the null pointer exception go away.

    ------------------------------
    Abby Embree
    Jama Software
    ------------------------------



  • 3.  RE: JAMA REST API "/comments" JAVA.NullPointerException

    Posted 09-19-2018 16:57
    Hi Abby,

    I have logged in as the user and selected the project. That is actually how I navigated to the item that I selected to post the comment onto. If we are using jamacloud, shouldn't we have the latest version? It is also upsetting the amount of feedback provided by the response.

    ------------------------------
    Jean Torres
    NIO
    San Jose CA
    7873154690
    ------------------------------