AnsweredAssumed Answered

How do I create a request through REST when the category has required properties?

Question asked by cspowell on Dec 5, 2016
Latest reply on Dec 6, 2016 by cdtj

Example of JSON being passed in through http post:

{
    "cr":{
        "requested_by":{"@COMMON_NAME":"Name, Example"},
        "customer":{"@COMMON_NAME":"Name, Example"},
        "category":{"@COMMON_NAME":"Example.Category.Symbol"},
        "log_agent":{"@COMMON_NAME":"Name, Example"},
        "assignee":{"@COMMON_NAME":"Name, Example"},
        "group":{"@COMMON_NAME":"Example Group"},
        "affected_service":{"@COMMON_NAME":"Example Affected Service"},
        "zrptmethod":{"@COMMON_NAME":"Example Report Method"}
    }
}

This normally works except for when trying to create a ticket where the category has properties and some of them are set to be required before it will allow the ticket to be saved.  I do not know how to add the properties into this JSON.

 

When trying to perform a post to create a ticket where Example.Category.Symbol has required properties with the above json, it gives back this response:
"One or more Properties require values."

When looking at the output of the command "bop_sinfo -d cr" I see two attributes (I believe) related to properties:
1) properties                       BREL <- cr_prp.owning_cr {owning_cr = ?}
2) add_property_persids    LOCAL STRING(0)

My understanding is that, since properties is a BREL, I would normally create the ticket (if properties aren't set to be required) and then perform a GET request on the request which was created asking for the properties which it has and use that information to update the properties by doing a PUT for each property I want to update in the cr_prp factory.  Or I could gather a list of properties by providing a query containing the owning_cr equal to the ticket I had creating and that would give me its properties list.  Unfortunately I cannot make it that far because it will not create a ticket unless I provide values for the required properties when creating it.

 

I would attempt to use the add_property_persids attribute except for the fact that since the ticket hasn't been created, none of the properties exist yet to have persids.

Is there some way I can do something with the properties attribute (adding it to my json) in order for it to add values to the required properties?

Outcomes