Error Code 503 | Server Error: API Proxy is not available - What do I do?

Hi, I'm attempting to use the EIkon API for the first time, and I'm getting the above error. I have Eikon installed and open.

Following this troubleshooting link, I determined that my Eikon proxy (called APIPROXY) is listening to port 9001, not 9000, which is the default for the API proxy. The troubleshooting guide says the Eikon proxy switches to 9001 if 9000 is not available. But the guide is not clear about what my solution should be. Should I change the API proxy to listen at port 9000? Or does the API also automatically switch to port 9001? Or is there some other solution?

The reason I have not just tried redirecting the Eikon proxy to listen at 9000 instead of 9000 is that I'm concerned about creating unexpected problems with my Eikon desktop.

I'm not a programmer, I'm just learning to do this on my own, so grateful for your patience.

Tks

Best Answer

  • I figured out that if I turn on my Thomson Reuters VPN I can now connect to the API proxy. No idea why.

Answers

  • Hi @zoya.farberov , It shows 9001.

    Tks


  • Hi,

    The Eikon proxy is running for several functionalities that can includes API Proxy, but not always.

    "Error Code 503 | Server Error: API Proxy is not available" means your Eikon variant is not permissioned for API Proxy (ex: Eikon Core variant).

    To check this, open http://localhost:9000/ping?all (or http://localhost:9001/ping?all)

    {"port":9000,"mode":"eikon4","pid":19064,"hasSecure":true,"startedTime":"Tue May 05 2020 22:22:43 GMT+0200 (Romance Daylight Time)","subApps":[{"path":"/heap"},{"path":"/ping"},{"path":"/sxs","data":{"hasSecure":true,"sxsApps":{}}},{"path":"/api"}]}

    If you don't have {"path":"/api"}, that will confirm this.

  • And if I ping 9001 I get:

    {"port":9001,"mode":"eikon4","pid":12148,"hasSecure":true,"startedTime":"Tue May 05 2020 08:02:53 GMT-0700 (Pacific Daylight Time)","subApps":[{"path":"/heap"},{"path":"/ping"},{"path":"/sxs","data":{"hasSecure":true,"sxsApps":{}}},{"path":"/api"}]}
  • Hi, I followed your suggestions, including restarting my computer. I have been dealing with this for a few days, so I have restarted the machine several times. My Eikon does shut down normally.

    If it helps, in the Eikon logfile that the troubleshooting guide refers to, I have these lines that may be relevant:

    [2020-05-05 21:08:14.845|1|api-svc|1|INFO] PO: SIDEBYSIDE,APIPROXY

    [2020-05-05 21:08:14.849|1|api-svc|3|DEBUG] create SIDEBYSIDE

    [2020-05-05 21:08:14.853|1|api-svc|3|DEBUG] create APIPROXY

    and ...

    [2020-05-05 21:08:14.966|1|data-api|1|INFO] Request API Proxy port number using channel=/api-proxy/port/request

    [2020-05-05 21:08:14.970|1|api-svc|1|INFO] Start server...

    [2020-05-05 21:08:14.986|1|api-svc|0|WARN] Server listen -> listen EACCES 127.0.0.1:9000

    [2020-05-05 21:08:14.993|1|api-svc|2|DEBUG] onStarted: 9001

    [2020-05-05 21:08:14.997|1|api-svc|1|INFO] Listening to port=9001



  • Hi @pierre.faurel, As I pasted just above, I do have that {'path':'api"}, so apparently not a permission issue. Also, see above some lines from the Eikon log file (mentioned in the troubleshooting guide) that I pasted in response to @zoya.farberov.

    Tks

  • @Noel

    As @zoya.farberov said, even though Eikon API Proxy on your machine is listening on port 9001, Eikon Data APIs library should get this port number from .portInUse file. From the SxS log file you provided and from the response you get from the ping, your account is entitled to use Eikon Data APIs. It's not clear where the problem is. Could you run the following Python code and let us know what you get from pyeikon logger?

    import eikon as ek
    import logging
    logger = logging.getLogger('pyeikon')
    logger.setLevel(5)
    ek.set_app_key(YOUR_APP_KEY)
  • HI @Alex Putkov

    Here's what I get:

    2020-05-05 14:49:36,708 P[13372] [MainThread 12568] Checking port 9001 response : 503 - API Proxy is not available 
    2020-05-05 14:49:36,711 P[13372] [MainThread 12568] Port 9001 was retrieved from .portInUse file
    2020-05-05 14:49:36,711 P[13372] [MainThread 12568] Try to handshake on url http://localhost:9001/api/handshake...
    2020-05-05 14:49:36,713 P[13372] [MainThread 12568] Response : 503 - API Proxy is not available
    2020-05-05 14:49:36,714 P[13372] [MainThread 12568] Response 503 on handshake port 9001 : API Proxy is not available
    2020-05-05 14:49:36,715 P[13372] [MainThread 12568] Application ID: THIS_IS_MY_APPKEY
    2020-05-05 14:49:36,715 P[13372] [MainThread 12568] Port 9001 on local proxy was detected


  • This is very, very strange... Perhaps you have some kind of local HTTP proxy running and that proxy interferes with some HTTP requests to the localhost while allowing others? I'm grasping at straws here. It would be interesting to see what occupies port 9000. Could you run "netstat -anb" in Command Prompt and see which process occupies port 9000? The Command Prompt needs to be launched with elevated privileges (aka run as administrator).

  • Hi @zoya.farberov Alex Putkov.

    I did as Zoya instructed.

    Port 9000 is being used by some security software to check for automatic updates. I don't feel comfortable being specific in a public forum but I am happy to message you.

    Port 9001 is being used by an EikonBox.exe, several of which are running in my task bar.

    I could try uninstalling the security software and see if that works, although it would note be a long-term fix.

    Also, to be clear, I am not a programmer and I am teaching myself Python. As a result, I have a nagging concern that the problem might be caused by me incorrectly installing the Eikon API in Python or making some other mistake. But If I can can run print(eikon.__version__) and get a response (in this case 1.1.2), then we can presume the API is correctly installed, right? Just want to make sure of that. And if I was able to run the logging function that Alex suggested using my appkey, then the problem is not with my appkey, right?

    Thank all of you for your help so far. This is really above and beyond.

    Noel

  • My Eikon version is 4.0.52 and it shows a checkmark and message saying I'm running the latest version.


    print(ek.__version__)
    output:
    1.1.2

    I originally installed the API using pip install eikon in jupyter, launched from anaconda. Then it occurred to me that maybe I should have installed it through a command prompt, so I did that as well. That has not changed the result.

  • Hi @Noel,

    Yes. And this looks good too.

    ---

    Have this idea: Shutdown Eikon. Make sure it is fully shut down via Task Manager, shutdown any Eikon processes if any remain.

    Make sure via netstat that 9001 post is not bound.

    Via "Services" app, try stopping the service for the app that binds on 9000.

    If successful (you may not have the permissions to do this, then the option is out), make sure via netstat 9000 is not bound.

    Restart Eikon.

    Via netstat, make sure 9000 is bound to Eikon.

    Check .portInUse file to be 9000 now.

    Try connecting via API.


  • Hi @zoya.farberov

    I went further, uninstalled the security software that was using port 9000, manually changed .portinUse to 9000, restarted computer and Eikon, ran logging.getlogger and got this:

    2020-05-06 08:36:45,627 P[24792] [MainThread 26040] Checking port 9000 response : 503 - API Proxy is not available

    2020-05-06 08:36:45,631 P[24792] [MainThread 26040] Port 9000 was retrieved from .portInUse file
    2020-05-06 08:36:45,631 P[24792] [MainThread 26040] Try to handshake on url http://localhost:9000/api/handshake...
    2020-05-06 08:36:45,635 P[24792] [MainThread 26040] Response : 503 - API Proxy is not available
    2020-05-06 08:36:45,636 P[24792] [MainThread 26040] Response 503 on handshake port 9000 : API Proxy is not available
    2020-05-06 08:36:45,637 P[24792] [MainThread 26040] Application ID: MYKEY
    2020-05-06 08:36:45,637 P[24792] [MainThread 26040] Port 9000 on local proxy was detected

    Ran netstat -anb at it says Eikonbox.exes LISTENING port 9000

    Browser ping:

    {"port":9000,"mode":"eikon4","pid":3424,"hasSecure":true,"startedTime":"Wed May 06 2020 08:35:27 GMT-0700 (Pacific Daylight Time)","subApps":[{"path":"/heap"},{"path":"/ping"},{"path":"/sxs","data":{"hasSecure":true,"sxsApps":{}}},{"path":"/api"},{"path":"/sxs/v1/services/messenger"}]}


  • Also @zoya.farberov

    Then, I closed Eikon, edited .portinuse to 9001 again, and now Python API can't find it for some reason. and netstat shows Eikon still using port 9000. Unsure why the API can no longer find .portinUse.

    Starting to think i should reinstall Eikon. What do you think?

  • @Noel.Randewich

    Reinstalling Eikon cannot hurt, but I don't think it will help. The tests you ran confirm there's no problem with the port logic. It works as expected. We've been able to isolate the problem to the handshake request failing, and I would suggest as the next step in troubleshooting to recreate the handshake request in a browser. I will need a bit of time to provide you the instructions, but I hope to do this today.

  • One thing you could do right away is check if Eikon API Proxy sends the dummy request to Eikon platform when it receives the handshake request. Ordinarily when you execute set_app_key method Eikon API Proxy sends HTTPS POST request to amers1.apps.cp.thomsonreuters.com/Apps/UDF/MSF (the CDN part of the request will vary by region: it may be amers2, emea1 or apac1, and the top level domain will be thomsonreuters.biz if you're on a private network) with the following body: {"Entity":{"E":"SymbologySearch","W":{"from":"RIC","symbols":["TRI.TO"],"to":["RIC"]}},"ID":"1"}. The purpose of this request is to validate the app key passed to set_app_key method.

    If you use Fiddler or another HTTP analyzer, do you see the above request going on the wire and if yes, does it come back with HTTP status 200 and the following in the response payload: {"mappedSymbols":[{"RICs":["TRI.TO"],"bestMatch":{"RIC":"TRI.TO"},"symbol":"TRI.TO"}]}?

  • @Noel.Randewich
    Thanks for the update. I'm afraid I cannot explain this either. I don't see why running VPN client would interfere with HTTP requests sent to localhost. On my end I have no problem connecting to Eikon API Proxy with or without running VPN client. If anything it would make more sense to me if it were the other way around, i.e. you could use Eikon API Proxy when not running the VPN client and couldn't when on the VPN. This said I'm glad you found a way to use Eikon API Proxy and I hope it's not too onerous that in your case you need to be on the VPN.