Highlighted
Respected Contributor.
Respected Contributor.
374 views

Add relation using the REST-api

Jump to solution

ucmdb 2018.11:

How do I add a relation using the REST API between to CI's I know the typ and ucmdbId of?

Let's say I have the two CI's:

{

'ucmdbId': '4fa27e3107050b38937ba48980d95d72',
'globalId': None,
'type': 'ip_address',
'properties': { ...}

}

{

'ucmdbId': '43c8f38cc9878270b5a9cc4d54d3e0f7',
'globalId': None,
'type': 'node',
'properties': {...}

}

Which i would like to relate to the following node using a containment relationship. But I can't see how I can easily add that relationship.

What I was trying was using the POST /dataModel API with the following request body:

{

'cis': [

{'ucmdbId': '4fa27e3107050b38937ba48980d95d72', 'type': 'ip_address', 'properties': {}},

{'ucmdbId': '43c8f38cc9878270b5a9cc4d54d3e0f7', 'type': 'node', 'properties': {}}

],

'relations' : [

{'type':'impact_containment: ', 'end1Id': '4fa27e3107050b38937ba48980d95d72', 'end2Id': '43c8f38cc9878270b5a9cc4d54d3e0f7', 'properties': {}}

]

}

but this does not seem to work: I get a 400 client error and the error in the wrapper log posteed below.

Derived from this I have the following questions:

* Am I using the right rest endpoint for this?

* If yes, how should a request body to the API actually look like in order to achive what I want?

 

 

wrapper.log:

-------------------

INFO | jvm 1 | 2019/05/02 07:36:10.594 | May 02, 2019 7:36:10 AM org.glassfish.jersey.filter.LoggingFilter log
INFO | jvm 1 | 2019/05/02 07:36:10.594 | INFO: 55 * Server has received a request on thread qtp245405293-581
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > POST https://localhost:8443/rest-api/dataModel/
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > Accept: */*
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > Accept-Encoding: gzip, deflate
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > Authorization: Bearer <TOKEN>
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > Connection: keep-alive
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > Content-Length: 338
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > Content-Type: application/json
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > Host: localhost:8443
INFO | jvm 1 | 2019/05/02 07:36:10.594 | 55 > User-Agent: python-requests/2.21.0
INFO | jvm 1 | 2019/05/02 07:36:10.594 |
INFO | jvm 1 | 2019/05/02 07:36:10.694 | 2019-05-02 07:36:10,608 [qtp245405293-581] ERROR Failed to process create request
INFO | jvm 1 | 2019/05/02 07:36:10.695 | com.hp.ucmdb.api.ExecutionException: appilog.framework.shared.manage.impl.MamResponseException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.695 | appilog.framework.shared.manage.impl.MamResponseException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.695 | CMDB Operation Internal Error: class com.mercury.topaz.cmdb.shared.base.CmdbException : java.lang.NullPointerException : operation DataInGracefulAddOrUpdate : class com.mercury.topaz.cmdb.shared.base.CmdbException :
INFO | jvm 1 | 2019/05/02 07:36:10.695 | CMDB Internal Error: Error while handling request: {request: ID='4c1c7d49c58a5d4abc81cec5d91085ba' Message='General CMDB request' Operation='com.hp.ucmdb.reconciliation.datain.operation.DataInGracefulAddOrUpdate@3e6158b6' Customer ID='1, id name: Default Client'
INFO | jvm 1 | 2019/05/02 07:36:10.695 | Context='CMDB Context: Customer id = '1, id name: Default Client' , User ID = '911' , Caller Application = 'REST client,loggedInUser:{admin###UCMDB}''}
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.server.local.LocalRequestSubmitter.handleException(LocalRequestSubmitter.java:199)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.server.local.LocalRequestSubmitter.internalSubmitRequest(LocalRequestSubmitter.java:112)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.client.AbstractRequestSubmitter.submitRequest(AbstractRequestSubmitter.java:53)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.server.embedded.EmbeddedRequestSubmitter.submitRequest(EmbeddedRequestSubmitter.java:54)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.client.UcmdbServiceImpl.submitRequest(UcmdbServiceImpl.java:434)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.client.RequestSubmitterWithContext.submitRequest(RequestSubmitterWithContext.java:29)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.client.UcmdbServiceImpl.submitRequest(UcmdbServiceImpl.java:425)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.client.AbstractService.submitRequest(AbstractService.java:19)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.client.topology.TopologyUpdateServiceImpl.handleCreateGracefullyRequest(TopologyUpdateServiceImpl.java:73)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.api.client.topology.TopologyUpdateServiceImpl.createGracefully(TopologyUpdateServiceImpl.java:46)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.rest.bridge.dataIn.DataInService.create(DataInService.java:34)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.rest.DataInController.create(DataInController.java:51)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at sun.reflect.GeneratedMethodAccessor223.invoke(Unknown Source)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:309)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:292)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1139)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:460)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.rest.filters.MetricFilter.doFilter(MetricFilter.java:39)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at com.hp.ucmdb.rest.filters.LogForgingPreventerFilter.doFilter(LogForgingPreventerFilter.java:41)
INFO | jvm 1 | 2019/05/02 07:36:10.695 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.rest.filters.CookieFilter.doFilter(CookieFilter.java:55)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.rest.filters.CredentialsFilter.doFilter(CredentialsFilter.java:36)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.rest.filters.CorsFilter.doFilter(CorsFilter.java:26)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.rest.filters.EncodingFilter.doFilter(EncodingFilter.java:28)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:51)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlets.DoSFilter.doFilterChain(DoSFilter.java:480)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:325)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:295)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.security.filters.HttpCachingPolicyFilter.doFilter(HttpCachingPolicyFilter.java:44)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.security.filters.HttpRequestMethodFilter.doFilter(HttpRequestMethodFilter.java:35)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.mercury.topaz.cmdb.server.manage.servlet.SecurityRestrictionsFilter.doFilter(SecurityRestrictionsFilter.java:37)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.mercury.topaz.cmdb.server.manage.servlet.LBSessionCookieFilter.doFilter(LBSessionCookieFilter.java:58)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.security.filters.HttpCachingPolicyFilter.doFilter(HttpCachingPolicyFilter.java:44)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.hp.ucmdb.security.filters.HttpRequestMethodFilter.doFilter(HttpRequestMethodFilter.java:35)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.mercury.topaz.cmdb.server.manage.servlet.SecurityRestrictionsFilter.doFilter(SecurityRestrictionsFilter.java:37)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at com.mercury.topaz.cmdb.server.manage.servlet.LBSessionCookieFilter.doFilter(LBSessionCookieFilter.java:58)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
INFO | jvm 1 | 2019/05/02 07:36:10.696 | at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.server.Server.handle(Server.java:530)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:289)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:149)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at java.lang.Thread.run(Thread.java:748)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | Caused by: appilog.framework.shared.manage.impl.MamResponseException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.697 | appilog.framework.shared.manage.impl.MamResponseException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.697 | CMDB Operation Internal Error: class com.mercury.topaz.cmdb.shared.base.CmdbException : java.lang.NullPointerException : operation DataInGracefulAddOrUpdate : class com.mercury.topaz.cmdb.shared.base.CmdbException :
INFO | jvm 1 | 2019/05/02 07:36:10.697 | CMDB Internal Error: Error while handling request: {request: ID='4c1c7d49c58a5d4abc81cec5d91085ba' Message='General CMDB request' Operation='com.hp.ucmdb.reconciliation.datain.operation.DataInGracefulAddOrUpdate@3e6158b6' Customer ID='1, id name: Default Client'
INFO | jvm 1 | 2019/05/02 07:36:10.697 | Context='CMDB Context: Customer id = '1, id name: Default Client' , User ID = '911' , Caller Application = 'REST client,loggedInUser:{admin###UCMDB}''}
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.server.manage.rpm.RequestProcessor.createCmdbResponseOnCmdbError(RequestProcessor.java:513)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.server.manage.rpm.RequestProcessor.processRequest(RequestProcessor.java:237)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.server.manage.rpm.RequestProcessor.handleRequest(RequestProcessor.java:141)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.server.manage.Framework.handleRequest(Framework.java:851)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.client.manage.api.impl.AbstractCmdbApi.executeCMDBOperation(AbstractCmdbApi.java:38)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.client.manage.api.impl.AbstractCmdbApi.executeOperation(AbstractCmdbApi.java:57)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.client.manage.api.impl.InternalApi.executeOperation(InternalApi.java:32)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.client.manage.api.impl.InternalApi.executeCMDBOperation(InternalApi.java:24)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.server.manage.ServerApiFacade.executeOperation(ServerApiFacade.java:56)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.server.manage.ServerApiFacade.executeOperation(ServerApiFacade.java:34)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.hp.ucmdb.api.server.topology.AbstractGracefulProcessor.process(AbstractGracefulProcessor.java:51)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.hp.ucmdb.api.server.topology.CreateCIsAndRelationsGracefullyProcessor.process(CreateCIsAndRelationsGracefullyProcessor.java:44)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.hp.ucmdb.api.server.topology.CreateCIsAndRelationsGracefullyProcessor.process(CreateCIsAndRelationsGracefullyProcessor.java:32)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.hp.ucmdb.api.server.request.AbstractCustomerRequestProcessor$1.doWork(AbstractCustomerRequestProcessor.java:25)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.shared.manage.AuthorizationEntryPointHelper.doProceed(AuthorizationEntryPointHelper.java:70)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.mercury.topaz.cmdb.shared.manage.AuthorizationEntryPointHelper.authorizeAndProcess(AuthorizationEntryPointHelper.java:34)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.hp.ucmdb.api.server.request.AbstractCustomerRequestProcessor.doProcess(AbstractCustomerRequestProcessor.java:22)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.hp.ucmdb.api.server.request.RequestProcessorBase.processAndLog(RequestProcessorBase.java:117)
INFO | jvm 1 | 2019/05/02 07:36:10.697 | at com.hp.ucmdb.api.server.util.ApiProcessingHelper.processRequestLocallyLocalMode(ApiProcessingHelper.java:70)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.api.server.local.LocalRequestSubmitter.processRequest(LocalRequestSubmitter.java:128)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.api.server.local.LocalRequestSubmitter.internalSubmitRequest(LocalRequestSubmitter.java:109)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | ... 102 more
INFO | jvm 1 | 2019/05/02 07:36:10.698 | Caused by: com.mercury.topaz.cmdb.shared.base.CmdbException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.698 | appilog.framework.shared.manage.impl.MamResponseException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.698 | CMDB Operation Internal Error: class com.mercury.topaz.cmdb.shared.base.CmdbException : java.lang.NullPointerException : operation DataInGracefulAddOrUpdate
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.operation.impl.AbstractCommonOperation.execute(AbstractCommonOperation.java:160)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.server.manage.rpm.RequestProcessor.doProcessRequest(RequestProcessor.java:252)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.server.manage.rpm.RequestProcessor.doProcessRequestWithQueueLimitation(RequestProcessor.java:269)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.server.manage.rpm.RequestProcessor.processRequest(RequestProcessor.java:215)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | ... 121 more
INFO | jvm 1 | 2019/05/02 07:36:10.698 | Caused by: appilog.framework.shared.manage.impl.MamResponseException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.698 | CMDB Operation Internal Error: class com.mercury.topaz.cmdb.shared.base.CmdbException : java.lang.NullPointerException : operation DataInGracefulAddOrUpdate
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.operation.impl.AbstractCommonOperation$OperationExecuteFlowTrackingCommand.execute(AbstractCommonOperation.java:114)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.operation.impl.AbstractCommonOperation$OperationExecuteFlowTrackingCommand.execute(AbstractCommonOperation.java:60)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.flowmanagement.api.FlowManager.execute(FlowManager.java:227)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.operation.flow.OperationInFlowDefaultExecutor.execute(OperationInFlowDefaultExecutor.java:23)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.operation.impl.AbstractCommonOperation.execute(AbstractCommonOperation.java:158)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | ... 124 more
INFO | jvm 1 | 2019/05/02 07:36:10.698 | Caused by: com.mercury.topaz.cmdb.shared.base.CmdbException: [ErrorCode [-2147483648] undefined error code]
INFO | jvm 1 | 2019/05/02 07:36:10.698 | java.lang.NullPointerException
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.reconciliation.datain.operation.AbstractDataInGracefulUpdateOperation.splitChunk(AbstractDataInGracefulUpdateOperation.java:221)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.reconciliation.datain.operation.AbstractDataInGracefulUpdateOperation.processFailedChunk(AbstractDataInGracefulUpdateOperation.java:167)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.reconciliation.datain.operation.AbstractDataInGracefulUpdateOperation.processChunk(AbstractDataInGracefulUpdateOperation.java:157)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.reconciliation.datain.operation.AbstractDataInGracefulUpdateOperation.dataInExecute(AbstractDataInGracefulUpdateOperation.java:93)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.reconciliation.datain.operation.AbstractDataInOperation.reconciliationExecute(AbstractDataInOperation.java:111)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.reconciliation.operation.AbstractReconciliationOperation.doExecute(AbstractReconciliationOperation.java:19)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.operation.impl.AbstractFrameworkOperation.commonExecute(AbstractFrameworkOperation.java:17)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.manage.operation.impl.AbstractCommonOperation$OperationExecuteFlowTrackingCommand.execute(AbstractCommonOperation.java:87)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | ... 128 more
INFO | jvm 1 | 2019/05/02 07:36:10.698 | Caused by: java.lang.NullPointerException
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.model.graph.decorator.CmdbGraphSpecifics.getVertextKey(CmdbGraphSpecifics.java:42)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.model.graph.decorator.CmdbGraphSpecifics.getVertextKey(CmdbGraphSpecifics.java:17)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.graph.v1.impl.LabeledVertexHashingStrategy.computeHashCode(LabeledVertexHashingStrategy.java:24)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.graph.v1.util.HashingStrategyDecorator.computeHashCode(HashingStrategyDecorator.java:26)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at gnu.trove.TObjectHash.index(TObjectHash.java:194)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at gnu.trove.TObjectIntHashMap.get(TObjectIntHashMap.java:191)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.graph.v1.impl.AbstractUndirectedGraphQuery.buildGraph(AbstractUndirectedGraphQuery.java:43)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.graph.v1.impl.UndirectedLabeledGraphQuery.<init>(UndirectedLabeledGraphQuery.java:53)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.mercury.topaz.cmdb.shared.tql.result.chunk.impl.GraphSplitUtils.splitGraph(GraphSplitUtils.java:68)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | at com.hp.ucmdb.reconciliation.datain.operation.AbstractDataInGracefulUpdateOperation.splitChunk(AbstractDataInGracefulUpdateOperation.java:218)
INFO | jvm 1 | 2019/05/02 07:36:10.698 | ... 135 more
INFO | jvm 1 | 2019/05/02 07:36:10.698 | May 02, 2019 7:36:10 AM org.glassfish.jersey.filter.LoggingFilter log
INFO | jvm 1 | 2019/05/02 07:36:10.698 | INFO: 55 * Server responded with a response on thread qtp245405293-581
INFO | jvm 1 | 2019/05/02 07:36:10.698 | 55 < 400
INFO | jvm 1 | 2019/05/02 07:36:10.698 | 55 < Content-Type: application/json
INFO | jvm 1 | 2019/05/02 07:36:10.698 |

0 Likes
1 Solution

Accepted Solutions
Highlighted
Respected Contributor.
Respected Contributor.

Re: Add relation using the REST-api

Jump to solution

I think I got it!. I did create the relaiton the wrong way around: Containment ip -> node, but instead it should be node -> ip. 

I did switch end1Id with end2Id and now it is adding relations. 🙂 thank you for your help.

View solution in original post

8 Replies
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Add relation using the REST-api

Jump to solution

Hi!

We are using the rest-api and POST, mostly with integrations on Business Element Layer (involving CI Collections). 

I guess your syntax looks ok. We are using the ucmdb id as a temp id but I read that you can use the actual id aswell. 

Can it be that "impact_containment" is not valid link type between this ci-types regarding the classmodel?  Can you try with some other link or objects just to see just if you can get it work? 

https://docs.microfocus.com/UCMDB/11.0/cp-docs/docs/eng/class_model/html/index.html

 

WBr / Fredrik

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Add relation using the REST-api

Jump to solution

 

My thought was that an empty properties field in both cis does cause the issue. I do have to do this because I only want to add the relation but not update any properties.

Do you know if that is possible?

I never actually considered that this is not a valid relation. Thank you for your answer. I will try to do that and provide feeback.

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Add relation using the REST-api

Jump to solution

Hi!

Not sure about the empty properties fields. 

But since the ucmdb id is known for you, I guess you could add the name in the properties field as well? If the name match it will not update anything. 

Maybe it does not work with just the ucmdb id. Perhaps you have to consider the identification rule for Node and ipaddress.

Wbr / Fredrik

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Add relation using the REST-api

Jump to solution

Ok slight change of plan. I refactored my code a bit and now I am trying to: add a new ip_address and relate that ip to an existing node. See the request / response below, but in short what I get is a 200 response, with the ip_address beeing added. But no relation.

I also tried:

* switching the relation type from impact_containment to just Containment which should be a valid relation type between Node and ip_address. According to : https://docs.microfocus.com/UCMDB/11.0/cp-docs/docs/eng/class_model/html/index.html

* add the name to the ci properties

--- REQUEST:

=== HEADER ===

POST /rest-api/dataModel/

HTTP/1.1

Host: localhost:8443

User-Agent: python-requests/2.21.0

Accept-Encoding: gzip, deflate

Accept: */*

Connection: keep-alive

content-type: application/json

Authorization: Bearer XXXXXXXXXXXXXXX

Content-Length: 458

===Body===

{"cis": [{ "type": "ip_address",  "ucmdbId": 3,  "properties": {"name": "2.2.2.1", "authoritative_dns_name": "bhost-first", "routing_domain": "b.network.local", "arp_mac": "ff00c1cc44cc", "ip_netaddr": "2.2.2.0", "ip_netmask": "255.255.255.0"}},   {"ucmdbId": "4cb8c7d19962a638b414d8116c93811f", "type": "node", "properties": {"name": "bhost"}}],   "relations": [{"type": "Containment", "end1Id": 3, "end2Id": "4cb8c7d19962a638b414d8116c93811f", "properties": {}}]}

---- RESPONSE

HTTP/1.1 200 OK

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Add relation using the REST-api

Jump to solution

I think I got it!. I did create the relaiton the wrong way around: Containment ip -> node, but instead it should be node -> ip. 

I did switch end1Id with end2Id and now it is adding relations. 🙂 thank you for your help.

View solution in original post

Highlighted
Respected Contributor.
Respected Contributor.

Re: Add relation using the REST-api

Jump to solution

Ah yes, and when adding a relation: both nodes must have at least one property set. Just specifying the ucmdbId alone does not work. This is a bit disappointing since I would just like to add a relation without updating or changing any properties.

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: Add relation using the REST-api

Jump to solution

Great that you got it work!

I guess adding for instance name of the ci in properties doesn´t update or change any properties, since you just specify the exact name already there? 

We are collecting business service and  a couple of other ci-type from uCDMB by the REST-API. We add information from an integration repository and updates CMDB with the new information. But since we have all the information about our business service already we just have key attributes in the properties field (which are the same that already exists in CMDB) of the json-file and then create/update relations to/from the BS. 

Wbr / Fredrik

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: Add relation using the REST-api

Jump to solution

Yeah in general, yes.

The name should not change. But isn't the whole point behind having an ID, that you don't have to address entities in the database by properties?..

Anyways. It kind of works for now and I do not thinkg that something else will change names of my CIs in parallel. So this should be safe. Again, thank you for your help. The pointer to the class model was exactly what I needed. I was only looking at the javadoc classmodel genrated by uCMDB. Which as far as I know does not provide any information about relations and directions. Feature request 🙂

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.