Can you embed a REST API response in Confluence wiki content?

Troy Cumbo February 9, 2014

I'm looking for a way to quickly embed some plain text output from a REST API (TeamCity) in a Confluence wiki page. I can't use the html-include macro, as it expects html and throws an error otherwise. The lone plugin that seems relevant hasn't been updated since many Confluence releases ago. I don't want to use the plugin or the TeamCity build status widget. I just need a little data from the server to sprinkle onto the page content I already have. Is there no way to just include the raw output from a URL regardless of its response type?

1 answer

1 accepted

1 vote
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 10, 2014

At a minimum, you can script it - Script Plugin for Confluence. Or you could treat the data returned as csv and use the CSV macro with the url.

Troy Cumbo February 11, 2014

I went with the CSV and it worked great Bob, thanks! All I needed was the url attribute with the macro.

one useme April 1, 2019

Could you please share the sample code Troy

Like # people like this
Troy Cumbo June 18, 2019

Hey sorry for the delay! Took me a while to find the code.

I went a different path after the CSV macro went paid (not that I didn't like the add-on, the functionality just wasn't important enough for the price given our seat count).

But if you have the add-on, use it like so:

{csv:url=http://teamcityserver/guestAuth/app/rest/builds/buildType:dev,status:SUCCESS,lookupLimit:1/number}{csv}

Which would return the build number of the most recent successful "dev" build.

Hope this helps.

Like cristian_balan likes this
Gabriel Diaz January 13, 2020

Troy - which alternate route did you go with? (non-paid). Thanks in advance.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events