Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

cancel
Showing results for 
Search instead for 
Did you mean: 
mikeitexpert
Active Member

Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

I use the post man to post the below query and it works just fine on my localhost but when I try the same on a remote server it give the blow error: Below please find the details:

http://<<IP ADDRESS>>:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children

And the response is a below:

Thanks for any clue / comment.

{
"error": {
"errorKey": "Unable to locate resource resource for :nodes children",
"statusCode": 400,
"briefSummary": "04290122 Unable to locate resource resource for :nodes children",
"stackTrace": "[org.alfresco.rest.framework.core.ResourceLookupDictionary.locateRelationResource(ResourceLookupDictionary.java:64), org.alfresco.rest.framework.core.ResourceLookupDictionary.locateResource(ResourceLookupDictionary.java:89), org.alfresco.rest.framework.webscripts.AbstractResourceWebScript.execute(AbstractResourceWebScript.java:63), org.alfresco.rest.framework.webscripts.ApiWebScript.execute(ApiWebScript.java:127), org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:418), org.alfresco.rest.api.PublicApiRepositoryContainer.transactionedExecute(PublicApiRepositoryContainer.java:45), org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:600), org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:380), org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:261), org.alfresco.rest.api.PublicApiRepositoryContainer.access$001(PublicApiRepositoryContainer.java:26), org.alfresco.rest.api.PublicApiRepositoryContainer$1.doWork(PublicApiRepositoryContainer.java:81), org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:119), org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:88), org.alfresco.rest.api.PublicApiRepositoryContainer.executeScript(PublicApiRepositoryContainer.java:77), org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378), org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209), org.alfresco.repo.web.scripts.TenantWebScriptServlet.service(TenantWebScriptServlet.java:74), org.alfresco.rest.api.PublicApiWebScriptServlet.service(PublicApiWebScriptServlet.java:53), javax.servlet.http.HttpServlet.service(HttpServlet.java:727), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208), org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208), org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208), org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220), org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122), org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504), org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170), org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103), org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950), org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116), org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421), org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074), org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611), org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2403), java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source), java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source), org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61), java.lang.Thread.run(Unknown Source)]",
"descriptionURL": "http://developer.alfresco.com/ErrorsExplained.html#Unable to locate resource resource for :nodes children"
}
}

1 Solution

Accepted Solutions
janv
Alfresco Employee

Re: Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

As Axel says ... can you please confirm the version of your remote server. Is it running <= ACS 5.1.x by any chance ?

Note: REST API to Create Node has been available since 5.2 (including 5.2.0 Enterprise).

Regards,

Jan

View solution in original post

6 Replies
afaust
Master

Re: Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

Are both Alfresco systems of the same version? Parts of the public ReST API are still being evolved and some operations/resources may not be available in all 5.2 versions (e.g. there were some additions in 5.2.1 - 5.2.3 Enterprise releases).

janv
Alfresco Employee

Re: Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

As Axel says ... can you please confirm the version of your remote server. Is it running <= ACS 5.1.x by any chance ?

Note: REST API to Create Node has been available since 5.2 (including 5.2.0 Enterprise).

Regards,

Jan

mikeitexpert
Active Member

Re: Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

That's probably it thanks for mentioning .... 

I wasn't sure how to check the version number. Just by comparing the login interface, it says 2005-2014 however, on local server says it says 2017.

I just have access to the servers front-end, how can I get the version number

If I go to the help under administration drop down it takes me the below link.

Using Alfresco One | Alfresco Documentation 

janv
Alfresco Employee

Re: Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

If you can login / sign-in  to Share then you should be able to click on the Share About box at the bottom of the page, eg.

Alternatively, if you're running ACS 5.2 (or higher) then you may also be able to access the following authenticated API:

https://hostname:port/alfresco/api/discovery

Alfresco Content Services REST API Explorer  (click drop-down for Discovery API)

Regards,

Jan

mikeitexpert
Active Member

Re: Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

Oh I see.... thanks so much man.

BTW, the REST API Explorer don't show up on Chrome, I had to use FF for that.

janv
Alfresco Employee

Re: Why do I get "400 Client Error: Bad Request for url" when I post to remote server but not a localhost server?

Jump to solution

No worries, I'm glad it helped.

As an aside: ACS 5.2.x provides the new public REST APIs and is also the baseline for future ADF-based applications. In short, ACS 5.2.x is the "best" release so far (well, at least until ACS 6.0.x goes GA in the next month or so) ... yes, I know, I'm biased.

So, this might be a great time to work with your Alfresco Enterprise sys admin to plan an upgrade from 5.0.0 to 5.2.3. I'm sure Alfresco Support will provide advice, as needed. 

Regards,

Jan