-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
502 Bad Gateway While Getting Started with API #1
Comments
@itsGreghere I was just notified of this issue. This is an okay place to log an issue. I think I may have been notified if you would have used the api-docs repo instead. Regardless let me see if I can help you. I've not used python so I may have to give it a try to see if the code you've written should work.
Depending on which APIs you want to use you may need a license. But let's deal with that after we get past your login issues. It requires nothing special to login. I'll try using your code to see if I see any issues with it. |
A couple of issues I've noted.
|
So if you are using a self signed cert you'll need to tell python to trust that cert. I don't recall how to get the actual pem file from a server. You can probably use curl to do it. Then you can tell |
@michaelgwelch Thanks for the responses! I'm going to try your suggestions and see if we can make any further progress. I am not a networking expert by any means, but it seems like the 502 error might mean we're not getting routed to the Metasys server. Do you know if the Launcher IP address is a proxy server? Assuming it's redirecting us to the local IP address on the network, would that be the same server/IP-address/port that we'd want to use for the API? The other thing we've been trying is VPN onto the network and use the local IP address, but we just get timeout errors there.. Is there an easy way to test the API locally, through a browser or something from a computer on the local network? I'm not on-site but could get help from someone who is, and that could help rule out whether it's a network issue rather than with the server/API. |
I agree with you. (Just an FYI that it is possible for Metasys Server to return a 502. For example when reading objects the server may need to forward a request to an NAE. If that NAE is offline or non-responsive then the server could return a 502. But, that would never happen on a login).
These three separate comments have me a little confused about your setup. If you are not on site, I'd expect you would have to use the VPN. You may have to give me more specifics about how you are setup. You may have to check with your site administrator. Where are you running Launcher from? Are you running that off-site without being on VPN and it's connecting to the server? I"m not sure how that would be possible but I guess it could suggest some sort of a proxy server. Or perhaps the site in question is addressable on the internet? (Typically we wouldn't recommend this for a production site). If it is on the internet then you'd probably be going thru some sort of proxy server.
Not sure what that means. You need to be able to send requests to the server so you need to be "on the same network". If you want to use a computer on the remote network you can use VPN and then Remote Desktop into the other computer and then use curl, powershell, postman or your python scripts. I can tell you that as our day to day work doing development/testing on Metasys we use VPN to get on our company network and then can call the API from our "at-home" computers to our "on-site" devices/servers. I guess I'd start with asking the site administrator to verify the IP address/hostname of the Metasys Server. Then I'd make sure you can access that ip or hostname when on VPN. So to summarize I think we need to get a better handle on your networking situation before we can tackle the API. |
The server is on the site which is a university campus with their own network. I am remote using my laptop. Using the Launcher IP address, we are able to get the 502 error.
These steps make sense. I'll see if we can double check the IP address using ipconfig, and that should confirm the first part. I'll try to find a way to validate that I can "see" the server's IP address once on the network. If I can do that, I'd have to assume the problem lies with the setup of the server / API itself. Thanks again for helping step through these details. |
I forgot to add.. We did try all the suggestions in your previous posts. They look to be very useful, so thank you.. I look forward to getting into the API to make sure of them. |
One more thing I tried is connecting to the site's network using VPN, then using I also tried Not sure if this is helpful or not.. I'm guessing the university wouldn't allow me to see EVERY device on the network. |
Very interesting. 169 addresses generally aren't "real" ip addresses. At least not 169.254 addresses. Who setup your laptop, or the launcher instance on your laptop? What do you see when you select this site in Launcher and click the wrench to see settings? I bet you see a proxy server setup in this section of the dialog: I'm curious if that dialog/proxy include credentials for the proxy. Often times they look like |
The Launcher setup was just installing the software, plugging in the IP/Host Name (provided by JCI FM team) and then logging in with my credentials. When I open the settings, my proxy selection is "none" like yours. Nothing in the Host : Port boxes. I'm happy to share more specific info, but not on a public repo. I contacted you on LinkedIn or if you email me at gcollins -at- zeroenvy.com I can reply with specific screenshots. |
Apologies in advance if this isn't the best way to request help. Let me know if there's another and I'd be happy to use that instead.
Background:
I am working on a campus project with 12 buildings where we've been extracting, processing & analyzing energy trend data from Metasys to provide regular energy reports. They just upgraded to 10.1 and purchased and installed the API. We have python applications that are processing the data, and are trying to develop a new data extractor using the API. I've reviewed all of the documentation, but it doesn't address the initial steps to install/activate the API on the server so we can start sending requests.
Issue:
Receiving a 502 Bad Gateway response using both Python (see below) and CURL from command line (trying to follow Historian example).
Python 3 Code:
(I replaced host IP address and login credentials with x's)
The IP address we're using is the same one we've been using in Launcher to log into Metasys. The tech who activated the API sent a screenshot of another IPv4 address, but we just get a TimeoutError using that one ("A connection attemp failed because the connected party did not preoprly respond...").
The text was updated successfully, but these errors were encountered: