I'm a bit embarrassed to ask, but I have some basic knowledge of APIs and have used Postman for simple GET and POST requests. Now, I'm facing a challenge where I need to string together three different API calls into a single workflow. The goal is to automate a process that interacts with a recycling vendor's API to manage devices. Here's the plan: 1) Fetch all devices listed under our company from the vendor's database. 2) Check our MDM database to see if these devices are present and delete them if they are. 3) Query Apple Business Manager to see if they exist and release them if applicable. 4) Finally, update the recycling vendor's API to indicate which devices have been removed. I need this to run automatically every night at midnight, but I'm unsure how to set this up, especially regarding where the API command should run from, given that my laptop will be off at that time. Should I ask my employer to set up a server for this? Also, do I need to include all API credentials in one command? Any advice on how to approach this would be greatly appreciated!
1 Answer
For a task like this, you'll definitely want to write a script in a language like JavaScript or Python instead of trying to handle it all in Postman. You can create a cron job that runs this script daily to manage the workflow automatically. This script will be crucial because it can handle the logic between calls and log the results. Just make sure to keep API keys and credentials secure, maybe using environment variables or a dedicated secrets manager.
That sounds like a solid approach! Since you're managing sensitive info, consider using a serverless solution like AWS Lambda to run the script. It’ll save you from having to manage a server yourself and it can still execute the job at the scheduled time.