Call save api in main program, added a few sanity checks to the URL.