Rally Software

Expand all | Collapse all

Need help creating Defect through Rest API - User Values

Jump to Best Answer
  • 1.  Need help creating Defect through Rest API - User Values

    Posted 03-05-2019 10:42 AM

    I'm trying to create a defect in Rally from another program (Cherwell) using the REST API. I'm able to create the defect, but only if I use the User objectID for SubmittedBy and Owner. I'd like to be able to create the defect by using a display name, or email address to populate these fields. 

     

    Do I need to perform some sort of lookup first to return the value? The program that I'm using has limited features to build the URLs, so not a lot of advanced coding capabilities. Any thoughts? An example of the parameters that I'm building would look like this:

     

    {
    "Defect":{
    "Name": "Incident.Short Description",
    "Description":"Incident.Description",
    "Environment":"Production",
    "Severity":"DefectSeverityCalc",  #(This is a calculated field based on the impact set on the incident reported)
    "Priority":"N/A",
    "Submittedby":"46965293434", (This is where I'd love to use an email address or full name)
    "Owner":"4943785267934",
    "Project":"50385372914"
    }
    }



  • 2.  Re: Need help creating Defect through Rest API - User Values
    Best Answer

    Broadcom Employee
    Posted 03-05-2019 12:36 PM

    Hi Keith,

     

    Internal references to objects within the API's object model use ObjectID for reference. That's the unique identifier for objects. When creating a defect, then you must specify user fields (such as Submitted By or Owner) by the user's ObjectID value. 

     

    You can make a query to the User endpoint to find out the ObjectID field using any filter you'd like (for example, based on DisplayName or EmailAddresss). Yet, these must be separate preceding queries you will need to execute in your program. There isn't an API 'lookup' where you can ask for it from the defect object you're building or posting. You'll need to execute this preceding query to get the user's objectID to add to your posted defect.

     

    I hope I answered your question. Let us know if additional questions.

     

    Thanks,

    Sagi



  • 3.  Re: Need help creating Defect through Rest API - User Values

    Posted 03-05-2019 02:21 PM

    I thought that might be the case, but wanted to make sure before I started wandering down that path. I appreciate the feedback. I have about 4 hours of REST API knowledge under my belt, which is why I'm so thankful for folks that take time out of their day to help!



  • 4.  Re: Need help creating Defect through Rest API - User Values

    Broadcom Employee
    Posted 03-05-2019 02:58 PM

    No problem Keith. If any next questions - just open a new discussion here (alternatively open a support case), and we'll be here again.

     

    Sagi