Access to Murano per Angular 2


#1

i want simple to read all data from Vendor as their devices and devices status from Murano per Angular,
here is code

exosite_url =“http://fe2j0gxxnyjk0529.m2.exosite.com/onep:v1/stack/alias?temp HTTP/1.1”;
let headers = new Headers({ ‘Content-Type’: ‘application/x-www-form-urlencoded; charset=utf-8’,‘X-Exosite-CIK’:‘my_cik’,‘alias’:‘humidity’ });
this.http.get(this.exosite_url, new RequestOptions({ headers: headers, method:‘GET’ })).map(res => res.json())
.subscribe(
data => console.log(data),
err => console.log(err)
);

but i becomme this error “XMLHttpRequest cannot load http://fe2j0gxxnyjk0529.m2.exosite.com/onep:v1/stack/alias?temp%20HTTP/1.1. Response for preflight has invalid HTTP status code 405” and my request from chrome “Request Method:OPTIONS”.
i think , i have no access to Murano per Webbrowser from outside


#2

Hi @farka, thanks for reaching out to us!

I’ve taken a look at the code you provided and I think see a couple problems:

  1. You need to remove " HTTP/1.1" from the end of your URL. This does not need to be included.
  2. You have an extra header ‘alias’:‘humidity’ which shouldn’t need to be included

Try your get call again after fixing these issues, and let us know how it goes!

-Joey


#3

thinks for replay, i do it, i have removed “” HTTP/1.1" from URL , and extra header ‘alias’:‘humidity’ . i got the same error “XMLHttpRequest cannot load https://fe2j0gxxnyjk0529.m2.exosite.com/onep:v1/stack/alias?temp. Response for preflight has invalid HTTP status code 405”

405 usually means you either tried a GET on something that only allows POST, or vice-versa, or tried http: on a method that requires https.


#4

es ist simple to read data device of Murano from outside per anuglar 2 per HTTP!


#5

Hey Farka,

It sounds like you have gotten things working, is there anything else we can help with?

Happy to help,
Eli


#6

i have always the same response header 405 from Murano, i want only to communicate with device (virtual digital) per http 80 from angular 2 (javascript ).i follow your instruction: HTTP1 is removed from url and ‘alias’:‘humidity’ is removed from request Header.
my code is :slight_smile:

exosite_url =“https://fe2j0gxxnyjk0529.m2.exosite.com/onep:v1/stack/alias?temp”;
" let headers = new Headers({ ‘Content-Type’: ‘application/x-www-form-urlencoded; charset=utf-8’,‘X-Exosite-CIK’:‘my_cik’});
let test = this.http.get(this.exosite_url, new RequestOptions({ headers: headers, method:‘GET’ })).map(res => res.json())
.subscribe(
data => console.log(data),
err => console.log(err)
);
"

thanks for response


#7

@farka -

i have always the same response header 405 from Murano

That means you are still sending a malformed request to Murano. You don’t appear to be specifying a port so Angular 2’s new HTTP module is probably using HTTPS default – 443. this.http.get already specifies the method that the module should use, so you can drop the method declaration.

You can read more about how Angular 2’s HTTP client works here: https://angular.io/docs/ts/latest/guide/server-communication.html.

Do you happen to be running this application locally, or on a server?

Thanks,
-Martin


#8

I want to test the connection locally and then in server,


#9

That’s great, this means you have the opportunity to inspect your message as it is being sent out.

Are you familiar with Wireshark? Could you create a .pcap of your read message?


#10

can i install wireschark, and put the ouput file from wireshark in .cab file, that whats you mean?


#11

I mean a packet capture file. If I remember correctly it is the default file format for Wireshark.

If you decided to compress it in a .cab, then I think OSX’s default unarchiver could still decompress that. The file itself isn’t very large, so there probably won’t be a problem sending it as-is.


#12

i have installed, tracking file .pcab is saved, but i can’t upload file pcap from wireshark, i have tried, hier output “Sorry, the file you are trying to upload is not authorized (authorized extension: jpg, jpeg, png, gif, ico).”, i have make it as zip file, but still can’t not uplode file, have you email adress, can i send you direct!


#13

The best address to reach me by is support@exosite.com. Feel free to attach any file, email that address will also open up a ticket.

I’ll look for you email.

-Martin


#14

you becomm now email under subject :exceet_exosite_parker_001

thanks


#15

just only test email


#16

We got your request! I reviewed your file and wrote back to you. Let’s continue this topic inside of that ticket.

FYI, this is a public forum. You may want to edit your post to remove your email address, anyone who reads this thread could now send you emails.