Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

We need to authenticate with this API.

The easiest way is to use Base Auth.

We need to use the Confluence GUI to create a token to combine your email address.

-- The main function is the first function called from Iguana.
function main()
   local ApiToken = "5gBjjIjuys5K0S6ggg3u94A2"
   local BaseToken = filter.base64.enc("richard.wang@interfaceware.com:"..ApiToken)
   local Page = '2184511505'
   local BaseUrl = "https://interfaceware.atlassian.net/wiki/rest/api/";
   
   local Data, Code, Headers = net.http.get{ 
      url = BaseUrl..'content/'..Page,
      parameters={
         expand='body.view'
      }, 
      headers = {
         Accept="application/json",
         Authorization="Basic "..BaseToken
      },
      live = true
   }
   local J = json.parse{data=Data}
   trace(J.body.view.value)
end

The code will require a valid ApiToken - no we haven’t compromised our security with this concept (smile)

This is what line 20 might give:

 

Further reading

  • No labels