App registration with the register mutation not working

We are currently working with AI bridge 1.7.2

One of our customers wants to set alerts for certain classes and it seems you can set an alert per topic. So when they deploy an app I need to look at the classes of the model and then make a new topic for each class.

Looking into the documentation I see that I need to make a new app and do a register mutation to add the topic without manually changing the register.graphql file and restarting the AI bridge.

I do a register mutation via graphIQL

and I looked in the logs of the container `nvcr.io/isv-milestone/partners/aibridge-webservice:v1.7.2` where I see

My question

  1. Why is this request failing ?

  2. Is this mutation the right way to handle this case for the customer where they want to create an alert and so need a new topic for it ?.

Your help is greatly appreciated and hoping to hear from you soon.

Hi there,

Would you mind sharing your mutation code.

I’ve tested this some minutes ago (on AI Bridge 2.0.0) in (1.7.2 - Manufacturer - ID is mandatory).

Step 1 - Get the VMS id:

query GetVms_ID { about { videoManagementSystems { id } } }

Step 2 - Use the VMS Id when registering the applications:

mutation register_app {
  register(
    input: {
      id: "8b88459a-0640-4026-a108-b3257410b773"
      apps: {
        id: "7CC520F4-9AC5-4E97-BD55-78C083A6C480"
        url: "https://www.google.com/"
        name: "dummy app"
        description: "Register, unregister test"
        version: "1.0.0"
        manufacturer: {
          name: "Milestone Systems A/S"
        }
        eventTopics: [{
          url: "https://www.youtube.com/"
          name: "topic1"
          description: "Topic 1"
          eventFormat: ANALYTICS_EVENT
        }, {
          url: "https://www.google.com/maps"
          name: "topic2"
          description: "Topic 2"
          eventFormat: ANALYTICS_EVENT  
        }],
        metadataTopics:[{
          url: "https://www.google.com/maps"
          name: "topic3"
          description: "Topic 3"
          metadataFormat: ONVIF_ANALYTICS
        }, {
        	url: "https://www.google.com/maps"
          name: "topic4"
          description: "Topic 4"
          metadataFormat: DEEPSTREAM_MINIMAL
        }],
        videoTopics:[{
          url: "https://www.google.com/maps"
          name: "topic5"
          description: "Topic 5"
          videoCodec:H264
        },{
          url: "https://www.google.com/maps"
          name: "topic6"
          description: "Topic 6"
          videoCodec:MJPEG
        }]
      }
    }
  ) {
    id
  }
}

MY VMS query to get the VMS id is is

query {
 
 about
 
 {
 
  videoManagementSystems
 
  {
 
   id
 
  }
 
 }
 
}

I then use this ID to do a register muaation with the following query

mutation register($input: RegisterInput!) {
 
 register(input: $input) {
 
  id
 
 
 
 }
 
}

My input variable is

{"input": {
 
 "id": "5901ddcb-76bd-4d15-b0b5-9048c8fcd102",
 
 "url": "xyz789",
 
 "username": "xyz789",
 
 "password": "abc123",
 
 "scope": "abc123",
 
 "zone": ["abc123"],
 
 "apps": [{
 
 "id": 4,
 
 "url": "abc123",
 
 "name": "xyz789",
 
 "description": "xyz789",
 
 "version": "abc123",
 
 "manufacturer": {"id": 4, "name": "xyz789"},
 
 "eventTopics": [{
 
 "url": "abc123",
 
 "name": "abc123",
 
 "description": "abc123",
 
 "eventFormat": "ANALYTICS_EVENT"
 
}],
 
 "metadataTopics": [{
 
 "url": "abc123",
 
 "name": "xyz789",
 
 "description": "xyz789",
 
 "metadataFormat": "ONVIF_ANALYTICS"
 
}],
 
 "audioTopics": [{
 
 "url": "abc123",
 
 "name": "xyz789",
 
 "description": "xyz789",
 
 "audioCodec": "G711"
 
}
 
],
 
 "videoTopics": [{
 
 "url": "abc123",
 
 "name": "xyz789",
 
 "description": "xyz789",
 
 "videoCodec": "MJPEG"
 
}]
 
}],
 
 "configMaps": [{
 
 "name": "abc123",
 
 "clear": false,
 
 "default": true,
 
 "properties": [{
 
 "key": "xyz789",
 
 "value": "abc123"
 
}]
 
}],
 
 
 
 "licensors": [{
 
 "id": 4,
 
 "name": "abc123",
 
 "licenses": [{
 
 "id": "4",
 
 "name": "xyz789"
 
}
 
]
 
}]
 
}}

where “id”: “5901ddcb-76bd-4d15-b0b5-9048c8fcd102”, is the form the query before

I get the same error

{
  "errors": [
    {
      "message": "Unexpected error.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "register"
      ]
    }
  ],
  "data": {
    "register": null
  }
}

I believe the problem may be related to the ID given to the app (4).

We’ve been using GUIDS as identifiers.

We will need to update our API documentation to reflect this.

Can you please try setting a new GUID instead of the number 4 for your App id.

Hi I changed my input so all ids are GUIDs

{"input": {
  "id": "5901ddcb-76bd-4d15-b0b5-9048c8fcd102",
  "url": "xyz789",
  "username": "xyz789",
  "password": "abc123",
  "scope": "abc123",
  "zone": ["abc123"],
  "apps": [{
  "id": "67842f3c-0940-4ea2-8a8c-1379e97dfb9f",
  "url": "abc123",
  "name": "xyz789",
  "description": "xyz789",
  "version": "abc123",
  "manufacturer": {"id": "d790d8a9-4e60-416a-b855-0c40d91039bb", "name": "xyz789"},
  "eventTopics": [{
  "url": "abc123",
  "name": "abc123",
  "description": "abc123",
  "eventFormat": "ANALYTICS_EVENT"
}],
  "metadataTopics": [{
  "url": "abc123",
  "name": "xyz789",
  "description": "xyz789",
  "metadataFormat": "ONVIF_ANALYTICS"
}],
  "audioTopics": [{
  "url": "abc123",
  "name": "xyz789",
  "description": "xyz789",
  "audioCodec": "G711"
}
],
  "videoTopics": [{
  "url": "abc123",
  "name": "xyz789",
  "description": "xyz789",
  "videoCodec": "MJPEG"
}]
}],
  "configMaps": [{
  "name": "abc123",
  "clear": false,
  "default": true,
  "properties": [{
  "key": "xyz789",
  "value": "abc123"
}]
}],
 
  "licensors": [{
  "id": "1769ebb6-82f6-439f-ad68-146c7456beea",
  "name": "abc123",
  "licenses": [{
  "id": "0f2954d1-67ff-448f-aaae-81fa112c4a8a')",
  "name": "xyz789"
}
]
}]
}}
 

but when I do the following mutation in graphiql

mutation register($input: RegisterInput!) {
  register(input: $input) {
    id
 
  }
}

I still get

{
  "errors": [
    {
      "message": "Unexpected error.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "register"
      ]
    }
  ],
  "data": {
    "register": null
  }
}

Hi there,

Looking again at your Json code there’re somethings I will try.

First, if the AI Bridge itself has already been registered using the register.graphql

That means that the information about the VMS has already been suplied there.

{
  url: "${VMS_URL}"
  username: "${VMS_USER}"
  password: "${VMS_PASS}"
}

Thus, there’s no need when registering an IVA app to pass:

url, username,password again.

And if you do, then the url must be the address of the management server, you’re passing:

"url": "xyz789",
  "username": "xyz789",
  "password": "abc123",

The easiest and shortest code to register an IVA app is the one I’ve posted above (some comments above).

One more thing we’ve seen is that you have an invalid graphql code:

"licenses": [{
  "id": "0f2954d1-67ff-448f-aaae-81fa112c4a8a')",   <----------

But again, if your IVA app doesn’t require license integration with XProtect the best thing to do is to follow the example provided above.

PS: We plan to improve this graphql responses in the next version of AI Bridge so the logs can give us more meaningful information in regards of the error…

Tried with out the credentials and also with the right ones. Also removed the ') from the string you pointed out and still I get

{
  "errors": [
    {
      "message": "Unexpected error.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "register"
      ]
    }
  ],
  "data": {
    "register": null
  }
}

Also I tried the above request you sent with the right milestone ID

mutation register_app {
  register(
    input: {
      id: "9db4a17e-cb01-46ac-bf06-4ebf878f2b15"
      apps: {
        id: "7CC520F4-9AC5-4E97-BD55-78C083A6C480"
        url: "https://www.google.com/"
        name: "dummy app"
        description: "Register, unregister test"
        version: "1.0.0"
        manufacturer: {
          name: "Milestone Systems A/S"
        }
        eventTopics: [{
          url: "https://www.youtube.com/"
          name: "topic1"
          description: "Topic 1"
          eventFormat: ANALYTICS_EVENT
        }, {
          url: "https://www.google.com/maps"
          name: "topic2"
          description: "Topic 2"
          eventFormat: ANALYTICS_EVENT  
        }],
        metadataTopics:[{
          url: "https://www.google.com/maps"
          name: "topic3"
          description: "Topic 3"
          metadataFormat: ONVIF_ANALYTICS
        }, {
        	url: "https://www.google.com/maps"
          name: "topic4"
          description: "Topic 4"
          metadataFormat: DEEPSTREAM_MINIMAL
        }],
        videoTopics:[{
          url: "https://www.google.com/maps"
          name: "topic5"
          description: "Topic 5"
          videoCodec:H264
        },{
          url: "https://www.google.com/maps"
          name: "topic6"
          description: "Topic 6"
          videoCodec:MJPEG
        }]
      }
    }
  ) {
    id
  }
}

and I get

{
  "errors": [
    {
      "message": "Field \"ManufacturerInput.id\" of required type \"ID!\" was not provided.",
      "locations": [
        {
          "line": 3,
          "column": 233
        }
      ]
    }
  ]
}

DO you think there is something with the way we set up the AI bridge itself that may cause this issue ?

Hi there,

This time the problem was that I was working with AI Bridge 2.0.0 (which I strongly suggest you to use).

If you check the release notes, we’ve deprecated/removed the field ‘Manufacturer → id’ on 2.0.0.

So if you’re using 1.7.2 then you should pass this field. But again, we encourage always to use the latest version and to check the release notes (you can find them in the NGC catalog:

Milestone AI Bridge | NVIDIA NGC )