Removing/disabling SpaceBridge SSH keys?


#1

Hi,

I accidently created multiple copies of the same key for SpaceBridge (I was trying to update the key, and didn’t realize the example API command was creating a new one each time, versus just updating the ones that already exist – oops!); I can’t find anydocumentation for the tunnelkeys API, but did figure out that I can query the keys like:

nc@knight:~$ curl -X GET -H "Content-Type: application/json" "https://dashboard.hologram.io/api/1/tunnelkeys?apikey=apikey" | json_pp
{
   "success" : true,
   "data" : [
      {
         "userid" : 123456,
         "id" : 114,
         "disabled" : 0,
         "public_key" : "sshpubkey"
      },
      {
         "public_key" : "sshpubkey",
         "disabled" : 0,
         "id" : 109,
         "userid" : 123456
      },
      {
         "disabled" : 0,
         "public_key" : "sshpubkey",
         "userid" : 123456,
         "id" : 107
      },
      {
         "userid" : 123456,
         "id" : 105,
         "disabled" : 0,
         "public_key" : "sshpubkey"
      },
      {
         "disabled" : 0,
         "public_key" : "sshpubkey",
         "id" : 84,
         "userid" : 123456
      }
   ]
}

…and an individual key like:

nc@knight:~$ curl -X GET -H "Content-Type: application/json" "https://dashboard.hologram.io/api/1/tunnelkeys?apikey=apikey&id=114" | json_pp
{
   "data" : [
      {
         "public_key" : "sshpubkey",
         "userid" : 123456,
         "id" : 114,
         "disabled" : 0
      }
   ],
   "success" : true
}

…but I can’t figure out how I can either set disabled to 1 or delete the key. If I attempt to POST with a JSON body of ‘{“disabled”:“1”}’, it returns:

{
   "success" : false,
   "error" : "An unknown error occurred"
}

…and the DELETE method is not accepted.

I’d appreciate any pointers to API doco, or else just details on the correct methods to remove or disable keys. Thanks!


#2

Hi there, you can do a POST to /tunnelkeys/:id/disable

I’ll make a note to update our docs on these endpoints.


#3

That worked perfectly - thanks!


#4

You’re welcome. Sorry for the confusion


#5

We just updated our API docs with more information about the tunneling keys endpoint: https://hologram.io/docs/reference/cloud/http#/reference/hologram-cloud/spacebridge-tunneling

Thanks for the report. Hope that’s helpful