Changing the end point in the Backendless.User class

I’m trying to add a new user to the DB but using Backendless.UserService.register(user)
gives (I replaced my key with *):

" POST https://api.backendless.com/*******/users/register 400 (Bad Request)
Server reported an error: Application with ID ******* does not exist
error code: 9000
http status: 400 "

but using fetch(“https://eu-api.backendless.com/************/data/Users”) works , which i think it works because of the eu endpoint .

so how can i make the Backendless.UserService.register(user) use eu endpoint ?

Hi, @Haytham_Atef

Your route must contain an appId and api key OR a backendless subdomain. This should look as follows:

The xxxx.backendless.app is a subdomain assigned to your application.
https://xxxx.backendless.app/api/users/register

OR
https://eu-api.backendless.com/{App ID}/{API Key}/users/register

As your application is located in the EU zone, you need to use https://eu-api.backendless.com in all routes. Or a subdomain assigned to your app.

Regards,
Marina

Thanks Mariana,

but does this mean that i can’t use Backendless.UserService.register(user) class with eu server?

Sure you can use all methods, everytning is the same as in US zone. The only difference is in the hosting zone. Please, you can read more at this link: Client-side Setup - Backendless REST API Documentation

Regards,
Marina

I have read your link but there is nothing about how to change the end point in the Backendless Class its only about changing endpoint to eu which i confirmed it’s working but i want to use the .Backendless Class methods which is used in all the documentation not fetch using url ,and btw i created a new app on us domain and the Backendless Class is working fine .

If your application is located in US zone, so only US zone endpoint will work for the app. And vise versa fot EU apps.
If you are talking about smth different, please add more info about your appId, steps you are doing and result you want to achieve.

Regards,
Marina

my app id is: B4754586-32AD-1A26-FFBD-2D0391803A00
like in this tutorial How to Login Registered Users to a Backendless App Using the User Login API

i should be able to use :

Backendless.UserService.login(‘spidey@backendless.com’, ‘greeng0blin’)
.then(onSuccess)
.catch(onError)

to login an existing user

this works on us server not on eu server

but using const res = await fetch(
https://eu-api.backendless.com/B4754586-32AD-1A26-FFBD-2D0391803A00/07278997-8FAC-49C2-9837-84BA3FF92DEB/data/Users
);
for example works cause in this method i can change api.backendless.com to eu-api.backendless.com

while in Backendless.UserService.login method i can’t find a way to do that

Hello @Haytham_Atef,

just make Backendless.serverURL = 'https://eu-api.backendless.com' before Backendless.initApp(..) function.

Regards,
Stanislaw