AnsweredAssumed Answered

Using UUIDs in REST Web Services

Question asked by SteveM_THR on Aug 29, 2017
Latest reply on Aug 29, 2017 by SteveM_THR

I have a current project, where the customers sends 'device name and problem description' to our automation processor.

I am supposed to:

      1. lookup the device UUID in MDB.  (specifically the "affected_resource")

               select [own_resource_uuid] FROM [mdb].[dbo].[ca_owned_resource]

      2. create incident ticket with the information

               I am attempting to update the Configuration Item attribute "affected_resource", 

               but to do this with REST Web Services I must have the UUID of the device.

                     <affected_resource COMMON_NAME="<deviceName>" REL_ATTR="<UUID>">

                                                   or

                     <affected_resource COMMON_NAME="<deviceName>" REL_ATTR="U'<UUID>'">

 

When I retrieve the UUID from the MDB, it is being converted.  

 I have tried rs.getString(), rs.getBytes, rs.getAsciiStream and all seem to have an invalid UUID.

How do I prevent this from happening?

I have seen posts to convert UUID to string and such.

      select [own_resource_uuid]

       ,dbo.unhex([own_resource_uuid]) AS UnHexed

       ,dbo.uuid_to_char(own_resource_uuid) AS uuidToChar

       ,[own_resource_uuid] AS sString

       ,CONVERT(varchar(max),[own_resource_uuid],2) AS myConvert

   FROM [mdb].[dbo].[ca_owned_resource]

   Where host_name = '<deviceName>'

 

But none of these processes seem to work when rebuilding the UUID to be used in the Web Service call.

I looked at pdm_deref, but that is un-practical for this application.

Is there a way to retrieve a UUID from the MDB, using a java program and MS-SQL, maintain the integrity of the UUID and then use the UUID in a subsuquent REST web services call?

 

 

Any help here would be appreciated, I seem to be going in circles.

Bottom line, I need to get a UUID from a DB query and then use the UUID in a REST Services create incident call.

 

Thanks

Outcomes