# Unable to make the API work

**URL:** <https://support.openanalytics.eu/t/unable-to-make-the-api-work/924>\
**Category:** ShinyProxy\
**Created:** [February 3, 2019, 10:52am UTC](https://support.openanalytics.eu/t/unable-to-make-the-api-work/924 "2019-02-03T10:52:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthieu\_Mulot](https://support.openanalytics.eu/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@Matthieu\_Mulot](https://support.openanalytics.eu/u/Matthieu_Mulot)\
**Post date:** [February 3, 2019, 10:52am UTC](https://support.openanalytics.eu/t/unable-to-make-the-api-work/924/1 "2019-02-03T10:52:18Z")

</div>

Hello,

First, thanks a lot for bringing Shinyproxy to the community. It’s a great tool !  
I’m excited by the new API features but can’t make it work, or at least partly.  
The setup :  
I have the minimal dockerized shinyproxy with docker engine running, built directly from the latest github repo.

So while in my browser, in can execute all the GET endpoints.  
From curl, and python requests.GET(), I can access the api/proxyspec endpoint, and I get a fine json that I can parse. However the /api/proxy endpoint is not working. I receive a 200 status code and an empty array, with the following headers (even though the 01\_hello container is launched):  
{  
‘Expires’:‘0’,  
‘Cache-Control’:‘no-cache, no-store, max-age=0, must-revalidate’,  
‘X-XSS-Protection’:‘1; mode=block’,  
‘Pragma’:‘no-cache’,  
‘Date’:‘Sun, 03 Feb 2019 10:20:55 GMT’,  
‘Connection’:‘keep-alive’,  
‘X-Content-Type-Options’:‘nosniff’,  
‘Transfer-Encoding’:‘chunked’,  
‘Content-Type’:‘application/json;charset=UTF-8’  
}

This endpoint works finely directly from the browser, where I get the expected json.

When I try to launch the 01\_hello container via curl -X POST [http://localhost:8080/api/proxy/01\_hello](http://localhost:8080/api/proxy/01_hello) i get a 400 bad request, with the 400 error html page.

I set up a flask webserver running on a docker container on localhost:80, serving the minimal ajax API control page from the github repo  
It’s not working and I get a CORS header problem, according to firefox.

So, I’m puzzled, and can’t figure out why it’s not working. Could someone give me a hint ?

Cheers,  
Matthieu

---

<div class="post-metadata">

**Author:** ![fmichielssen](https://support.openanalytics.eu/user_avatar/support.openanalytics.eu/fmichielssen/32/1088_2.png) [@fmichielssen](https://support.openanalytics.eu/u/fmichielssen)\
**Post date:** [February 7, 2019, 9:39am UTC](https://support.openanalytics.eu/t/unable-to-make-the-api-work/924/2 "2019-02-07T09:39:13Z")

</div>

Hi @Matthieu_Mulot,

I think there are 2 issues in play here:

1. The endpoint `POST /api/proxy/{proxySpecId}` requires a JSON body, even though it’s not used for any purpose. That’s a bug, we will fix this in an upcoming release. As a workaround, you can add a body using a `curl` like this:

2. Getting an empty array from `GET /api/proxy` may be an authentication issue, where the browser session and curl session cannot see each other’s proxies. What type of authentication are you using?

---

<div class="post-metadata">

**Author:** ![Matthieu\_Mulot](https://support.openanalytics.eu/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@Matthieu\_Mulot](https://support.openanalytics.eu/u/Matthieu_Mulot)\
**Post date:** [February 10, 2019, 1:31pm UTC](https://support.openanalytics.eu/t/unable-to-make-the-api-work/924/3 "2019-02-10T13:31:55Z")

</div>

Thank you for your answer.

Using an empty json did actually work, thanks for the tip !  
However I still get an empty array with the GET method to api/proxy, with identification disabled (set to none).

But the good thing is that I can now launch containers from my website. thanks !

---

<div class="post-metadata">

**Author:** ![tverbeke](https://support.openanalytics.eu/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@tverbeke](https://support.openanalytics.eu/u/tverbeke)\
**Post date:** [March 24, 2019, 1:33pm UTC](https://support.openanalytics.eu/t/unable-to-make-the-api-work/924/4 "2019-03-24T13:33:57Z")

</div>

Hi @Matthieu_Mulot,

The fix has been released as part of ShinyProxy 2.2.0 (see [https://www.shinyproxy.io/downloads/](https://www.shinyproxy.io/downloads/)). Note that it is now also possible to secure the ShinyProxy API using OAuth 2.0.

Best,  
Tobias
