add sql query to json header from API in development environments
add error logging