API Versioning

Hey @mebeingken, I’m about to setup APIs and wondering if this is still working for you or if you’ve found any major challenges with it?

Hey Keith,

For MealPro I actually abandoned the preload process that I outlined there. Now I just set a base_url value and an api_path and use that in any server connect actions and forms.

  <dmx-serverconnect credentials id="get_posts" url="/api/1/2/dashboard/get_posts" dmx-bind:url="base_url.value + api_path.value + '/dashboard/get_posts'" site="Meal Planner Pro"></dmx-serverconnect>

The base_url is because we white label the mobile app, so that part might not be relevant for you.

No major challenges, just remember that if you add an output value to an existing api in your mobile app, it won’t show up in the ui bindings until you increment the version in the static url parameter. You can of course do I global find/replace to bring those all to the new version. I rarely run into this issue.

The creation of a new api version requires a terminal command to increment the new api’s to use the new libraries (assuming those are also versioned,), update the web app, routes, etc. I run the following in a few folders:

find . -type f -not -path '*/\.*' -exec sed -i '' -e 's/1\/1\//1\/2\//g' {} +
1 Like