selectQuery using rest api

Posted by Rollbase User on 11-Apr-2012 05:52

Hi all, I tried using the rest API to get the data from my object however i recieve an error HTTP 500 internal error I dont know if my query is correct encoding or my rest API is not correctly formed. QUERY: SELECT '', name, inquiry_date, name_of_inquirer, address_inquirer, contact_inquirer, name + ', ' + details, type_of_inquiry, service_provider, type_of_inquirer, CASE WHEN main_classification LIKE 'Product Quality%' THEN source_plant ELSE ISNULL(area + ' / ', '') + ISNULL(region, '') + CASE WHEN area IS NULL THEN ISNULL(plant, '') ELSE '' END + ISNULL(national_office, '') END AS [regionPlantorNationalOffice], product_sku, quantity, uom, type_defect, attended_by, date_attended, resolved_by, date_resolved, action_taken_and_upd, status, area, region, CASE WHEN main_classification LIKE 'Product Quality%' THEN source_plant ELSE plant END, main_classification, secondary_classifica, tertiary_classificat FROM statistics WHERE inquiry_date BETWEEN '3/01/2012' AND '4/01/2012' URL Encoded QUERY: SE

All Replies

Posted by Admin on 11-Apr-2012 16:22

Please chech error mesage in server's response.

Posted by Admin on 11-Apr-2012 22:06

Is there any way for us to check the error? this is the screenshot of the error page?



Do I need to ask our network administrator to see the error of the server?



Posted by Admin on 11-Apr-2012 22:10

UPDATE I saw the rest api log file and this is the error details



[2012-04-11 19:24:04,187] selectQuery query=SELECT id, name FROM inquiry WHERE date_of_inquiry BETWEEN 2/01/2012 AND 3/01/2012

[2012-04-11 19:24:42,329] selectQuery query=SELECT '', name, inquiry_date, name_of_inquirer, address_inquirer, contact_inquirer, name + ', ' + details, type_of_inquiry, service_provider, type_of_inquirer, CASE WHEN main_classification LIKE 'Product Quality%' THEN source_plant ELSE ISNULL(area + ' / ', '') + ISNULL(region, '') + CASE WHEN area IS NULL THEN ISNULL(plant, '') ELSE '' END + ISNULL(national_office, '') END AS [regionPlantorNationalOffice], product_sku, quantity, uom, type_defect, attended_by, date_attended, resolved_by, date_resolved, action_taken_and_upd, status, area, region, CASE WHEN main_classification LIKE 'Product Quality%' THEN source_plant ELSE plant END, main_classification, secondary_classifica, tertiary_classificat FROM statistics WHERE inquiry_date BETWEEN '2/01/2012' AND '3/01/2012'

[2012-0

Posted by Admin on 12-Apr-2012 02:40

ANOTHER UPDATE!:



I tried to make the query much more simple to remove the complex query as a result of the REST error, these are the resulting logs



QUERY:



SELECT name, inquiry_date, name_of_inquirer, address_inquirer, contact_inquirer, name FROM statistics WHERE inquiry_date BETWEEN '3/01/2012' AND '4/01/2012'



URL ENCODED QUERY:



SELECT%20name%2C%20inquiry_date%2C%20name_of_inquirer%2C%20address_inquirer%2C%20contact_inquirer%2C%20name%20FROM%20statistics%20WHERE%20inquiry_date%20BETWEEN%20'3%2F01%2F2012'%20AND%20'4%2F01%2F2012'



REST API ERROR LOG:



[2012-04-12 15:36:27,676] selectQuery query=SELECT name, inquiry_date, name_of_inquirer, address_inquirer, contact_inquirer, name FROM statistics WHERE inquiry_date BETWEEN '3/01/2012' AND '4/01/2012'

[2012-04-12 15:36:27,707] ===> Error in thread ajp-8009-7 at 04/12/2012 03:36 PM: Error:

[2012-04-12 15:36:27,707] java.lang.NullPointerException

at com.rb.core.services.api.ServerSideAPI.toJS(ServerSideAPI.java:1063)

at com.rb.core.services

Posted by Admin on 12-Apr-2012 20:05

ANOTHER UPDATE



I tried using an even simpler query without parameters and this is the error result ive been recieving:



I used a simple web browser to test the REST API and placed this in my URL:



https://xxxx.xxx.xxx/rest/api/selectQuery?sessionId=rest-2164039219397483205&startRow=0&maxRows=50000&query=SELECT%20name%2C%20inquiry_date%2C%20name_of_inquirer%2C%20address_inquirer%2C%20contact_inquirer%20FROM%20statistics





ERROR LOG:



[2012-04-13 09:01:05,154] selectQuery query=SELECT name, inquiry_date, name_of_inquirer, address_inquirer, contact_inquirer FROM statistics

[2012-04-13 09:01:05,263] ===> Error in thread ajp-8009-2 at 04/13/2012 09:01 AM: Error:

[2012-04-13 09:01:05,263] java.lang.NullPointerException

at com.rb.core.services.api.ServerSideAPI.toJS(ServerSideAPI.java:1063)

at com.rb.core.services.api.ServerSideAPI.selectQuery2(ServerSideAPI.java:325)

at com.rb.rest.logics.controller.ApiController.selectQuery(ApiController.java:261)

at com.rb.rest.logics.servlet.ApiServlet.doGe

Posted by Admin on 13-Apr-2012 01:06

This will be fixed soon. Please submit support request to follow up.

This thread is closed