AnsweredAssumed Answered

Login POST JSON Error

Question asked by rmsiegel on Apr 17, 2013
Latest reply on May 13, 2015 by sandeepthukral
All,

I'm new to Alfresco trying to learn the API. I'm trying to do what I thought should be a straight-forward command. I'm using CURL to send my commands to Alfresco. My CURL command is:

c:\> curl -X POST -d @login.json "http://192.168.0.151:8080/alfresco/service/api/login"

My JSON file is this:

{"username":"bob","password":"bob"}

The error response I'm getting is this:

{
    "status" :
  {
    "code" : 400,
    "name" : "Bad Request",
    "description" : "Request sent by the client was syntactically incorrect."
  },

  "message" : "03170015 Unable to parse JSON POST body: A JSONObject text must begin with '{' at character 0",
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 03170015 Unable to parse JSON POST body: A JS
ONObject text must begin with '{' at character 0",

  "callstack" :
  [
          ""      ,"org.springframework.extensions.webscripts.WebScriptException: 03170015 Unable to parse JSON POST body: A
JSONObject text must begin with '{' at character 0"
      ,"org.alfresco.repo.web.scripts.bean.LoginPost.executeImpl(LoginPost.java:87)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.executeImpl(DeclarativeWebScript.java:235)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:410)"
      ,"org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:479)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:517)"
      ,"org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:278)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
      ,"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)"
      ,"org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)"
      ,"org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)"
      ,"org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)"
      ,"java.lang.Thread.run(Thread.java:662)"

  ],

  "server" : "Enterprise v4.1.3 (97) schema 5,118",
  "time" : "Apr 17, 2013 3:09:45 PM"
}

I figure I'm doing something very basic incorrectly but cannot see it.

Any ideas?

TIA,
Bob S.

Outcomes