how I should create relationships between ci's via webservice? What is the method?
I dont believe there is a web services call to create CI relationships. In fact, we do not recommend using web services for creating CIs or CI relationships, but rather we recommend to use the GRLoader utility. You can see more about using that utility here:
General Resource Loader - GRLoader - CA Service Management - 14.1 - CA Technologies Documentation
Since you didn't specify, I assume you are referring to the SOAP web service.
You could do this with the createObject method. The object in this case is bmhier.
Jon_Israel tigdias Lindsay_Estabrooks
GRLoader utility is a good option, but not for my use-case.
My use-case expects me to be able to create Configuration Item (assets) from anywhere.
Here is a python scripts for ServiceDesk using WebService like,
this one to gets change request incident status:
getIncidentStatus.py · GitHub
Now, I am trying to create python script to create Configuration Item(Asset ) using USD_WebService
I found this is probably the endpoint to call (Technical Reference Guide Release 12.7.00 )
[CreateAsset(SID: xsd:int, attrVals: ArrayOfString, attributes: ArrayOfString) -> CreateAssetResult: ]
But, I couldn't find much documentation around what attrVals and attributes expect.
Could you or someone with this info please guide me. Some example code (any language) will be very helpful.
I am sure someone has already gone through this before.
Appreciate the support very much.
1. attrVals is an array of strings with attribute name/value pairs for the attributes you want to populate. For example:
Note that when the attribute type is SREL then the value you use is the persistent ID (aka handle) of the object instance being referenced.
2. attributes is an array of strings that list the attributes whose value you want to retrieve as a result of creation. I usually put only the id of the object instance that has been created. For example:
Your reply is very helpful.
I am able to create Assets now.
One question regarding loading Attributes and Relationships
1. Is it good idea to populate attributes as part of one CreateAsset web-service method.
or use UpdateObject(SID: xsd:int, objectHandle: xsd:string, attrVals: ArrayOfString, attributes: ArrayOfString)
to update various objects like 'nr'(Asset)?
2. Use CreateObject(SID: xsd:int, ObjectType: xsd:string, attrVals: ArrayOfString, attributes: ArrayOfString) web-service method to create parent child relationship between assets.
where,I passed the input requested:
attrVals=["child","child_ci_id", "ci_rel_type","ci_rel_type_id", "parent", "parent_ci_id", "tenant", "tenant_id", "description", "test bmhier"]
Is there a better way to create relationship?
no better way, but another one.
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header/><SOAP-ENV:Body><impl:createObject xmlns:impl="http://www.ca.com/UnicenterServicePlus/ServiceDesk"> <sid>58031346</sid> <objectType>bmhier</objectType> <attrVals> <string>child</string> <string>2136A478A9DB1B4686B376AC059A1F47</string> <string>ci_rel_type</string> <string>300049</string> <string>parent</string> <string>714E7C657893C343B8CA5A7BC6459F70</string> <string>tenant</string> <string>7333464F3BD2E446ADE2DFF0B06A59DE</string> <string>description</string> <string>Test:bmhier over WebService</string> </attrVals> <attributes> </attributes> <createObjectResult>createObjectResult__</createObjectResult> <newHandle>newHandle__</newHandle></impl:createObject></SOAP-ENV:Body></SOAP-ENV:Envelope>
Retrieving data ...