Use API tie-in to pull data from Netbox to Confluence

Aaron Myers April 4, 2023

I'm trying to figure out a way to pull data in from Netbox to display on some Confluence pages. Netbox has a good API but I don't have any idea how to make this work with Confluence. I've looked at Script Runner but to be frank, probably a bit out of my zone. I looked at the native Webhooks but didn't see a trigger event of a page load. 

 

Any ideas on how to accomplish this?

Thanks,
Aaron

2 answers

1 accepted

0 votes
Answer accepted
Aaron Myers August 31, 2023

Thanks for reminding me I had this outstanding question, @Chris Hefner. I eventually figured out how to make it work using the plugin ConfiDoc.

https://marketplace.atlassian.com/apps/1212211/confidoc-viewer-for-sql-xml-json-csv

To get it configured, in Netbox, create an API token and copy the value.

After installing the plugin, use Authentication Request Header configuration type. Service URL is from the documentation with Netbox but in my case, I want to get information about a device so my Service URL looks something like 

https://netbox.example.com/api/dcim/devices/[deviceid]

For Method I'm using GET and a timeout of 60. I believe these are the defaults. For header name use Authorization and for Header value enter your API token. Then you should be able to test by feeding it a valid device ID. Just make sure Netbox allows requests from your Confluence instance (firewall or whatever you may have setup). 

I'm sure there are other ways to do it, but in my case I wanted to get the rack name and location on the page. To do that, insert the ConfiDoc ListView container macro and choose the configuration source you made for Netbox. I left all the defaults otherwise. 

Then inside the ListView macro, insert the ConfiDoc Field macro. To get the rack name the value of the field would be rack.name. I noticed the preview doesn't actually work so you have to save & load the page to test. To insert the location name, add another Field macro but this time set the field name to location.name. If I remember right all the field names just map to the API documentation for Netbox.

Hope that helps.

Aaron

Kevin Dow November 15, 2023

Thank you, @Aaron Myers . I understand ConfiDoc is only available for Data Center or Server. Are you aware of a similar plugin that would pull in JSON for Confluence Cloud? I'm trying to do something similar with the Zoho suite.

Thanks,

Kevin

0 votes
Chris Hefner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 30, 2023

I second this. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events