Action not found when trying to make REST request

Hello!I’m trying to dispatch custom event through REST

i tried with postman and with request lib from npm like this:


var options = {
        method: 'POST',
        uri: 'https://api.backendless.com/servercode/events/invoicePaid',
        headers: {
            "application-id": "here is my app id",
            "secret-key": "here is my secret key",
            "application-type": "REST",
            "Content-Type":"application/json"
        },
        body: {
            "some": "something aga"
        },
        json: true // Automatically parses the JSON string in the response 
    };
 
    return request(options)....

but anyway got action not found

Hi Svyatoslav,

Is your Backendless backend in version 3.x or 4.0 ? (what is the version number in console right next to the logo in the upper left corner?)

The API you use is for 3.x, but I suspect your app is in 4.0.

Regards,
Mark

4

Yes, i see… But i can’t find anything about dispatching custom events inside docs for version 4, could you help me with this?

You can see it right here:

https://backendless.com/docs/bl-java/doc.html#api-for-dispatching-custom-events

Somehow that section didn’t make into the server code in JS doc.

The problem in your code is the app-id and API key should be in the URL instead of the headers.

Regards,
Mark

Thanks! i’ll try this