Unable to query data via SQL REST API

Document ID : KB000118747
Last Modified Date : 31/10/2018
Show Technical Document Details
Introduction:
The customer was trying to use the curl and SoupUI to get data from the SQL Rest API feature.  He would get a 404 error from a collector when he was querying the MOM.  If the customer use the Get is would work but the Post would fail
Background:
Below is an example of the error shows why this KB article was written.
Error Produced when attempting to query: 

curl -Lk -H "Authorization: Bearer XXXXXXXXXXXX" -H "Accept: application/json" -H "Content-Type: application/json" http://agent_host:8081/apm/appmap/apmData/query -d '{ "query" : "select * from sources;" }' 


"_links": { 
"description": { 
"href": "https://docops.ca.com/rest/ca/product/latest/topic?hid=HID_EM_API&space=APMDEVOPS106&language=&format=rendered

}, 
"errorCode": "EA0500", 
"errorMessage": "Query failed for Collector01@5001 - 404:Not Found - <html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"/>\n<title>Error 404 NOT_FOUND</title>\n</head>\n<body><h2>HTTP ERROR 404</h2>\n<p>Problem accessing /apm/appmap/apmData/query. Reason:\n<pre> NOT_FOUND</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n\n</body>\n</html>\n", 
"timestamp": "2018-09-29T15:42:11.489Z" When the 
Environment:
10.7
Instructions:
The problem was in the query string.
http://agent_host:8081/apm/appmap/apmData/query

The Developers told us this was a know issue and that we should add /private URL

http://agent_host:8081/apm/appmap/private/apmData/query query 
Additional Information:
Guide  - SQL REST API