Blog Post

Tech Talk
2 MIN READ

Self-Service LogicModule Management for Unprivileged Users?

AustinC's avatar
AustinC
Icon for Neophyte rankNeophyte
8 months ago

Has anyone taken to managing LogicModules via the API in APIv3? My immediate use case is to facilitate self-service (but ‘gated’) functionality to my end users, while ensuring that we don’t need to confer administrative access to said users. By leveraging GitHub, we can stand up workflows that will allow us to audit and approve myriad LogicModules at first, and establish version control so that, if someone makes a bad change, we can quickly fix/revert.

That said, it appears APIv3 no longer supports DataSource imports, and it seems like this is due to less buy-in from the community, where folks tend to leverage the Exchange more readily than APIs.

So, on that front, a few thoughts:

  • I’m intuiting that I can introspect some of the API calls via the browser to PUT/POST/GET DataSources -- has anyone reverse engineered these and leveraged them?
    • I understand this amounts to a hack, and that there are likely unknown pitfalls to doing this - If anyone has done this and can share some wisdom, that would be great
  • Are there other opportunities to implement our own version control/workflows for managing these? e.g. is there a way to facilitate this through the Exchange?
    • I have a strong desire to limit administrative tasks for importing an unprivileged user to the click of a button (e.g. a Pull Request approval) so as to limit the amount of hands-on work my team needs to do to facilitate datasources developed by other teams
  • If leveraging the API is a non-starter (due to reliability, hackiness, myriad other pit falls), is anyone implementing a strategy to democratize LogicModule management to unprivileged users?
    • I’ve not been able to introspect any reasonable paths to facilitating this (apart from having users build DataSources in Sandbox, and then we import them to Production), and it seems like the only way to do this would be to give our users Admin access to manage their datasources via the GUI -- obviously this is an immensely bad idea, so we won’t be doing this :) 

Does anyone have any wisdom to share on the subject, philosophical or practical?

Published 8 months ago
Version 1.0

3 Comments

  • Anything that you can do via the UI can be done via the API.

    You can either use your browser's developer tools to see how his works, or check out my signature and use our MIT-licensed (free) library.

    Finally, there's an option whereby we can implement this for you.

  • it seems like this is due to less buy-in from the community, where folks tend to leverage the Exchange more readily than APIs.

    Sounds like the words of someone in LM marketing that is invested in the exchange’s success.

    The call you’re looking for is POST /santaba/rest/setting/logicmodules/importfile?type=datasource

    As @David Bond mentioned, this can be obtained by going through the process in your browser with the dev tools open on the network tab. Look for the POST in the Method column. The XML is passed in as a binary. Yes, it works in API v3.

  • Yep, I’ve already captured some of the calls in the browser, and it even looks like the browser leverages JSON when POSTing/PUTting data (which would be _very_ helpful, if, indeed, it’s possible to use it) -- I figured I would put this out to the community, just in case there was something obvious I was missing. Appreciate the thoughts here -- I’ll explore some of the angles.