5 Replies Latest reply on May 18, 2018 12:19 AM by Devendra Dehadaraya

    Cannot Create Organization Object in CLM via ReST API

    Yudi Maryanto
      Share This:

      Hi,

       

      I try to create Organization object on CLM via ReST API as explained on Organization create request - Documentation for BMC Cloud Lifecycle Management 4.6 - BMC Documentation . I took the sample json request on that document, stripped down "additionalInfo" field, and send it to CLM ReST API. But I got error "Site for user is missing from the user payload." like this

      y.PNG

       

      Here is my json request. What parts are missing from my json object?

      json.PNG

        • 1. Re: Cannot Create Organization Object in CLM via ReST API
          Devendra Dehadaraya

          I believe Site information is mandatory while creating the organization. You need to pass Site details in additionalInfo section of the JSON input body.

          • 2. Re: Cannot Create Organization Object in CLM via ReST API
            Yudi Maryanto

            Hi Devendra Dehadaraya

             

            What is the correct json structure to pass the site information? from this document Organization class - Documentation for BMC Cloud Lifecycle Management 4.6 - BMC Documentation , it says that "Organization" class takes "locations" attribute. I tried to pass "locations" attribute like this, but it was failed with error message "Unrecognized field locations".

            create-tenant01-req.PNG

            resp01.PNG

             

            I also tried to pass the location infromation using "foundationLocationObject" just like you told me when creating User object (Create CLM User using ReST API ). It also didn't work with similar error message as above (Unrecognized field "foundationLocationObject")

             

            create-tenant02-req.PNG

            • 3. Re: Cannot Create Organization Object in CLM via ReST API
              Devendra Dehadaraya

              May be you can try this -

               

              {

                "timeout" : 1000000,

                "callbackURL" : "",

                "postCallout" : "",

                "operationParams" : [ {

                  "name" : "organization",

                  "value" : {

                    "cloudClass" : "com.bmc.cloud.model.beans.Organization",     

                    "description" : "created via rest-update-update",    

                    "foundationLocationsObject" : [ {

                      "cloudClass" : "com.bmc.cloud.model.beans.FoundationLocation",

                      "customFieldsObject" : [ {

                        "cloudClass" : "com.bmc.cloud.model.beans.CustomField",

                        "description" : "Country",

                        "name" : "sit_site.1000000002",

                        "stringValue" : "<CountryName>",

                        "type" : "String"

                      }, {

                        "cloudClass" : "com.bmc.cloud.model.beans.CustomField",

                        "description" : "StateProvince",

                         "name" : "sit_site.1000000003",

                        "stringValue" : "<StateName>",

                        "type" : "String"

                      }, {

                        "cloudClass" : "com.bmc.cloud.model.beans.CustomField",

                        "description" : "City",

                        "name" : "sit_site.1000000004",

                        "stringValue" : "<CityName>",

                        "type" : "String"

                      } ],

                       "name" : "<TenantLocationName>"

                    } ],

                       "name" : "<TenantName>",

                    "parentOrganizationObject" : {

                      "cloudClass" : "com.bmc.cloud.model.beans.Organization",

                       "name" : "<TenantName>"

                    }

                  },

                  "type" : "com.bmc.cloud.model.beans.Organization",

                  "multiplicity" : "1"

                },{

              "name" : "isRemote",

              "value" : true,

              "type" : "java.lang.Boolean",

              "multiplicity" : "0..1"

                                              }],

                "preCallout" : ""

              }

              • 4. Re: Cannot Create Organization Object in CLM via ReST API
                Yudi Maryanto

                Hi Devendra Dehadaraya

                 

                Thanks a lot. It works. But I have a few things to be clarified. As a user that consume CLM ReST API, I heavily relied on the official CLM ReST API documentation. there are a few things I want to ask related to "Organization" class

                 

                1. On the API documentation, it is said that "Organization" class has "locations" attribute

                location.PNG

                but in your sample json request, you specify the attribute name as "foundationLocationObject" instead of "locations"

                foundationLocationObject.PNG

                The same thing with "customeFields" attribute. In the API documentation, it is said  that "Organization" class has "customFields" attribute. But again, in your sample json request, you put "customFieldsObject" instead of "customFields".

                I cannot figure out what is the pattern of when we must append "Object" in the atribute name. Or Is the API documentation incorrect?

                 

                2. In "CustomField" class documentation, The "name" attribute is a String. It is said that it is a "human-readable name of the object". But I see that you use the "name" attribute differently. It seems that "name" attribute can have some kind of pattern to refer to a field on another ARS form. Could you point me to the documentation that explain the patterns that can be used in this "name' attribute? Honestly, just by reading "CustomField" class documentaion here I will never realized that it can be used to push value to other ARS form.

                 

                customFieldClass.PNGinteresting.PNG

                 

                Thanks. Once again, you really shed light on this CLM API usage that is not mentioned in the official documentation. I think BMC really really should incorporate your explanation in this discussion as well as your explanation in many other discussions into the official CLM API documentation to prevent confusion and frustration

                • 5. Re: Cannot Create Organization Object in CLM via ReST API
                  Devendra Dehadaraya

                  Thanks for your feedback. We will definitely consider it.