HodorNV / ALOps

ALOps
59 stars 24 forks source link

[Feature Request] ALOpsOpenAPI: Include 'CompanyId' to parameters #552

Closed Arthurvdv closed 1 year ago

Arthurvdv commented 2 years ago

Is your feature request related to a problem? Please describe. The goal is here is to use the generated OpenAPI-file in combination with https://editor.swagger.io (for ad-hoc support). For 99% of the API-endpoints we need to pass a CompanyId, which isn't a default available parameter.

Describe the solution you'd like image Automatic adding a parameter Company to certain endpoints.

Not sure it the required should be true. For example the /companies endpoint should not have this requirement. And maybe some unbound API endpoint also could work without a companyid? Not sure if it's possible to determine this dynamically based on the EDMX data?

Additional context image It would be awesome to have it as a global variable if that's possible. For example as a variable attached to the available servers, so that you only have to enter the CompanyId once.

waldo1001 commented 2 years ago

We'll look into it, but no promise.

We do have one tip for anything onPrem (like docker environments): https://www.waldo.be/2022/02/28/business-central-api-leave-out-companyid-from-the-url/

AdminHodor commented 1 year ago

Dear @Arthurvdv ,

We found a work-around for this, although slightly different.

On the ALOpsOpenAPI step, you can set 'exclude_company_paths' to 'true'. This setting will not only strip all duplicate paths containing 'CompanyID's', it will also the possibility to set the "Company ID" global. Header insert was not possible, but a work-around via authentication did the trick.

To set the global 'Company ID', go to the "Authorize" window in Swagger editor, there you find a field to set the CompanyID. image

The company ID can removed again by using the "Logout" function on this field.

Please check our latest release v1.454.3354 for this feature.

Kind regards,