API calls not working outside of Backendless but working when invoking within Backendless

Application ID: AEEDEBFE-9F8F-4E66-FF14-289B5C449700

Network Error

RT Log starts with “ResponseError: [object Object] at checkStatus” error.

Problem description

Problem started after I whitelisted a specific domain and then switched back to allow all domains.

Steps to reproduce

Please describe steps to reproduce starting from the first action.

  1. API calls from a 3rd party service keep using null parameters.
  2. Invoking, API calls from Backendless works well.

Hello, @Kgothatso_Diale

Can you describe more detail your problem? Will be good if you provide step to reproduce your problem.

Regards, Nikita.

I made 3 API methods to a API Service, which call external endpoints. Recently, I changed the domain whitelist from All to point to a specific address. However, when I reverted that change, I can now only Invoke the API calls in Backendless when I try to call them from a 3rd party application such as Postman the query parameters don’t get parsed, instead they are null. Before the domain whitelist, everything was functioning from both within Backendless and from Postman.

What kind of requests are you calling? Which ones work for you and which ones don’t. And also from where?

Currently, all API calls are giving me an issue, the response that are used to get was null, but now it is “An internal trouble ticket with ID bl-server …”. The issue lies with the parameters being parsed as null.

I correctly understand that your requests in API service? Can you send examples of the code that not works. And describe the steps to reproduce your problem?

try {
    return (await Backendless.Request['post']((function(url){ if( !url ) { throw new Error('Url must be specified.')} if( !url.startsWith('http://') && !url.startsWith('https://')) { return 'https://' + url } return url})('https://graph.facebook.com/v18.0/134147519780939/messages')).set(({ [`Authorization`]: String('Bearer ') + String((typeof ___methodArguments !== 'undefined' ? ___methodArguments['token'] : token)),[`Content-Type`]: 'application/json' })).setEncoding('utf8').send(({ [`messaging_product`]: 'whatsapp',[`recipient_type`]: 'individual',[`to`]: (typeof ___methodArguments !== 'undefined' ? ___methodArguments['phone_number'] : phone_number),[`type`]: 'text',[`text`]: ({ [`preview_url`]: 'false',[`body`]: (typeof ___methodArguments !== 'undefined' ? ___methodArguments['message'] : message) }) })));

  } catch (error) {
    console.log(error);

  }

That is the code I copied from the codeless block, the problem is that the API parameters, methodArguments array is passing null values( when launched in Postman), whereas the hard coding( using the text code block with the actual strings of token, message and phone_number) results in the API functioning even outside of Backendless.

Can you send screenshot of your logic?

We need to understand your problem to solve it. Can you please give answer to our questions and we can help you in this case:

  1. Screenshot of your logic.
  2. Steps to reproduce this issue.
  3. Describe the problem in detail:
    3.1. What methods are you calling.
    3.2. What behavior are you trying to achieve.

Regards, Nikita.

The circled parameters are being parsed as null when sent from outside of the application. They work when invoked from Backendless.

Hi @Kgothatso_Diale

Have you tried to print these “null” values?
Please share what your request (outside of Backendless) looks like

Regards,
Vlad

The values are being parsed as null, as aforementioned.

then the API call

then the response on the RT logger

for POST methods you need to pass params in the request body as a JSON object instead of in URL as query params, and do not forget about ContentType application/json

Thanks Vladimir, it’s functional now.