API HTTP Request in JavaScript

Hy There!

I have a own (external) site and want to make for every new user on my own site, a new user on the Softr site I’ve made. That sounds like an easy thing to me, but I’m in problem with the API.

Softr has a cURL API request for creating new users, but I want the API call via JavaScript so I could automate this in my own site.

I’ve tried to translate the cURL to JS but it gives me an error. Anyone who knows how to do it in JS, or see my faults?
As I run the API request in a cURL compiler with the same entries, it works!

I use the free version of Softr. My domain is .softr.app where is a chosen string.

Thanks in advance for your help!

Note: I also would use the other API calls, but as example I took the “create-user”.

image

I think this has to do with fetch not sending all headers due to cors. I need to do some more research.

1 Like

BTW I would really not expose this via JS code in UI as it would be security issues to expose your API key and expose others create users for your app

Thanks for the advice and help! I’m not integrating it in the UI of something directly for users visibility.
I’m going to use it in the backend of my (non-softr) site in the system of creating users on that site.
So it is in no cases visibile for others.

Now this fails due to browser cors if you call it from non browser it should actually work