CA Service Management

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

    Posted Dec 05, 2016 05:52 PM

    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?



  • 2.  Re: How do I create a request through rest when the category has required properties?

    Posted Dec 05, 2016 10:53 PM

    Hi,

    regarding to the TextAPI try to define it using mask: 

    "property":{"label":"value"}

     

    PS: I had the same issue when I tried to create ticket using custom method via webservices and finally resolved it using SPEL post filling in this way:

    1. on ticket initialization, add_property_persids fills by properties persids separated by whitespace;

    2. each property updating using it's persid.



  • 3.  Re: How do I create a request through REST when the category has required properties?

    Posted Dec 06, 2016 11:23 AM

    Thanks for your reply.  Unfortunately, when trying this solution it does not seem to be working when I modify the JSON (to add properties in that format) I'm sending through the REST api.



  • 4.  Re: How do I create a request through REST when the category has required properties?
    Best Answer

    Posted Dec 06, 2016 02:46 PM

    sad to hear, but seems it's impossible, check this techdoc: Knowledge Base Articles 

    btw: SOAP WebServices have possibility to handle properties on creation.

     

    Regards,

    cdtj