I have a channel on my thingspeak 'button-state, i created native plugin to this channel. I want to find a way where i can use Jquery button to communicate with my thingsnetwork. I have the following i attempted, but i am getting 404 NOT found if i do POST method.
A 404 Not Found is typically returned when the URL is wrong, or when the given resource is not found in some database. For the HTTP Integration, the URL youâre using seems okay, so youâd need to check and double-check the application ID, the process ID and the device ID.
Now, looking at your payload, it says:
That attribute name device_id is wrong; that should read dev_id. It seems you already corrected that, given the following from another closed deleted topic:
But did you indeed change that in your jQuery code as well?
Also, are you sure that the process ID that you entered in the HTTP Integration (and which is part of the URL) matches the device ID (as part of the POST message)? The integration works for all devices in the application, so using a process ID that matches a single deviceâs name might not make a lot of sense, and surely is confusing.
Also, please provide references or explanations on the changes you made. Without knowing why you did it, data:JSON.stringify({Makers:makers}) makes no sense: where is Makers in {Makers:makers} coming from? And: what is the result of your new code? And above all: why donât you respond to the questions I asked in my earlier answer?
Iâd say that your first example was better, except for the errors that I pointed out in my first answer.
Errr, it took you 3 days to answer âi believeââŚ? Investigate, please! If itâs different, then the URL in your jQuery code is wrong. In that code, the process ID in the URL is the same as the dev_id in the JSON data, so you need to make sure they match what you see in TTN Console.
Well, no:
Success; Iâm going to ignore this very topic but maybe someone else wants to help you if you provide much more details.
i am getting now 404 Not found. Here is revised code below for my Jquery code.
$(document).ready(function() {
$(â#toggle_event_editing buttonâ).click(function(){
if($(this).hasClass(âlocked_activeâ)) {
$(â#switch_statusâ).html(âSwitched offâ);
$.ajax({
url:âhttps://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/acts083_test/mkr1300?key=ttn-account-v2.7Ph6lBffU7wI9cLY5ljIhIb_I7sqH5EVvo5zs9uVyA0â,
type:âPOSTâ,
data:{
payload_raw: âAAAâ,
dev_id:âmkr1300â
},
success:function(response){
alert(response);
},
error:function() {
$(â#errorâ).text(âThere was an error while processing your request. Please try againâ);
}
});
What this code, i want to send a message to things network using ajax request, URL i have i got it from thingsnetwork after configured the application for lorawan device
I have tried to investigate and ways of fixing this error, basically i want to send message back to my things network tnn console, using Post method on my Jquery rest. Here is my error.
Thanks for raising this with me, which means i have to find a way around this on the things network console to allow such request to pass without security from the browser. As mentioned TTN does not offer such. There is nothing i can do on the client side?
Yes i did, but the major issue i had amongst, was this new one i just proposed today. I have amended my Jquery code and end up seeing the issue from the client side.
For the second topic proposed to use either AWS or Azure, we not unfortunately using those cloud mechanism for our proof of concept, we will consider them when we use major projects. For now using proof of concept to our client. I dont know as i am restricted.
Anything that runs on some server will do. Even some PHP script can translate a GET into the proper POST including the secrets for the integration, and such server-side PHP script will not enforce CORS. Of course, anyone who would know the URL could invoke that, unless you come up with some security.
If you really cannot set up a server of your own (but then I wonder what value you have for your client), then something like this might help:
(Iâm not sure that allows for changing the HTTP method, using something like request.request_method = 'POST'. See its examples.)
Correct me something, if i had to try to use putsreq as my own server to test my Jquery. First DSN is from the site itself. While if i am passing my post method using my own. I am getting 500 status message. âInternal Server Errorâ XMLHttRequest is not defined" https://putsreq.com/agT2991XWmifYEvy20Uy/inspect