REST API documentation for modifying tenant variables

The Swagger documentation for the following operations/endpoints appears to be incomplete:

POST /api/tenants/{id}/variables
POST /api/{baseSpaceId}/tenants/{id}/variables

No example body is given for either of these, and the on-page test sends no body with the request, resulting in:

{
“ErrorMessage”: “There was a problem with your request.”,
“Errors”: [
“No request body was supplied.”
],
“ParsedHelpLinks”: []
}

I have tried a number of different schema in attempts to guess the expected payload, but have had no success. Could you point me in the right direction?

Regards,
Vern DeHaven

Hi Vern,

Thanks for reaching out. Just to make sure we are talking about the same type of variables, could you send me a screenshot of where would you be seeing/adding these variables from the UI if you were doing it manually?

Once I have that I should be able to send you an example.

Thanks

Sure:

Hi @Vern_DeHaven,

I meant from the Octopus app UI, not the swagger one. Sorry I wasn’t more specific in my previous reply!

Thanks

Oh, sorry about that. Here are two examples:

Project-level:

Common:

Hi @Vern_DeHaven

You are correct, our Swagger implementation is not showing the right body that the request is expecting. I’ve raised this to our team and we’ll take care of it.

In the meantime I recommend you to add a value to one of those variables through the UI, save it and inspect the POST call generated by the save action using your browser’s development tools. That should give you an examply of the body that the app is expecting.

Screenshot example:

JSON posted in the example of the screenshot: https://gist.github.com/Dalmirog/0fa402657f669e24647f2dafeeab2577

Let me know if that helps,
Dalmiro

Thanks Dalmiro! I was so close; just needed to add a template as the last ingredient.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.