cancel
Showing results for 
Search instead for 
Did you mean: 

API Playground

koxon_
Confirmed Champ
Confirmed Champ

Hi,

I am trying to use the API playground.

I added the following CORS config to my app:

 <component name="org.nuxeo.cors">
  <extension target="org.nuxeo.ecm.platform.web.common.requestcontroller.service.RequestControllerService" point="corsConfig">
    <corsConfig name="all" 
                allowGenericHttpRequests="true"
                allowOrigin="*"
                allowSubdomains="true"
                supportsCredentials="true">
      <pattern>/nuxeo/*</pattern>
    </corsConfig>
  </extension>
</component>

Trying to connect, I get this:

Remote Address:127.0.0.1:8080
Request URL:http://localhost:8080/nuxeo/site/automation/login
Request Method:OPTIONS
Status Code:401 Unauthorized

Then a second is being made by the playground, and I get this:

Remote Address:127.0.0.1:8080
Request URL:http://localhost:8080/nuxeo/authentication/token?applicationName=Nuxeo%20API%20Playground&deviceId=device-176&deviceDescription=device-176&permission=rw
Request Method:OPTIONS
Status Code:302 Found

The API Playground doesn't connect to my local server. Any idea?

Thanks Nicolas

5 REPLIES 5

Nelson_Silva
Confirmed Champ
Confirmed Champ

Hi,

First thing to try is to change the pattern to /nuxeo/.* as this is a regular expression.

It that doesn't work you should try connecting from an incognito tab in Google Chrome just to see if it works. (The playground stores some login information using cookies and there might be some consistency issues.)

For reference, this is what I normally use:

<component name="org.nuxeo.cors.config">
  <extension target="org.nuxeo.ecm.platform.web.common.requestcontroller.service.RequestControllerService" point="corsConfig">
    <corsConfig name="all" supportedMethods ="GET,POST,HEAD,OPTIONS,DELETE,PUT">
      <pattern>/nuxeo/.*</pattern>
    </corsConfig>
  </extension>
</component>

Hope it helps.

Tried what you said. Still no luck.

Following the doc here

Ok, let's start from the beginning. Where did you put your CORS config ? Should be in nxserver/config/*-config.xml (I have it in nxserver/config/cors-config.xml).

koxon_
Confirmed Champ
Confirmed Champ

The issue was that in Studio I included the TAG:

<component name="org.nuxeo.cors.config">

Studio generates it for you and it is not needed.

However it still doesn't work for my local setup in Eclipse. I reference localhost in the playground and it still fails. On my Cloud instance installed using apt-get, it works fine however.

Locally I get this JSON error:

code: "com.sun.jersey.api.NotFoundException"
entity-type: "exception"
message: "null for uri: http://localhost:8080/nuxeo//site/automation/login";
status: 500

I re-installed the SDK from scratch but I still get the same error. I believe this class is missing somehow in the Eclipse SDK. Or something is miss-configured.

Any idea?

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.