While executing cURL commands, no feedback is received from AEM. The terminal displays no results after the command execution.
For example, the command below returns nothing
curl -u admin:pass http://IP:PORT/
The cURL command does not display any results on the terminal because the response sent by AEM server contains no message in the body of the HTML response. Instead, the HTTP error code is displayed in the headers of the HTTP response.
Usually, the problem is either the user name and password provided in the curl command are not correct, or the credentials are not getting through as expected to the AEM server. To understand the problem, use -v flag in the cURL command to understand the nature of the error.
The following command, which returns no results can be modified as explained below:
FROM curl -u admin: pass http://IP:PORT/ TO curl -v -u admin: pass http://IP:PORT/
The result on the terminal may appear such as the following, which indicates the error code as HTTP 401 Unauthorized.
* Trying ::1... * Connected to IP (::1) port PORT (#0) * Server auth using Basic with user 'admin' > GET /aem/start.html HTTP/1.1 > Host: IP:PORT > Authorization: Basic YWRtaW46YWRtaW4= > User-Agent: curl/7.43.0 > Accept: */* > < HTTP/1.1 401 Unauthorized < Date: Thu, 17 May 2018 14:05:09 GMT * Authentication problem. Ignoring this. < WWW-Authenticate: Basic realm="Sling (Development)" < Transfer-Encoding: chunked < * Connection #0 to host IP:PORT left intact
curl -v -u 'admin:pass' http://IP:PORT/
You can confirm if you are getting other errors by adding the -v flag to the curl command to include the HTTP headers in the output such as:
curl -v -u admin: admin http://localhost:4502/crx/packmgr/service.jsp?cmd=help