All Forums Tools
davidtzoor 5 posts Joined 06/14
05 Sep 2016
Passing parameter in Teradata Rest Service

Hi,
I am using Teradata Rest Service and trying to pass a parameter for my query:

select ? as ip_address
from my_database.ip_table as g
where internallib.ip2ip3(ip_address) between g.start_ip and g.end_ip
;

This is how my request looks like:

{ url: 'http://my_server:1080/tdrest/systems/service_name/ queries',
  gzip: true,
  json: true,
  headers:
   { Authorization: 'Base 64 auth',
     Accept: 'application/vnd.com.teradata.rest-v1.0+json',
     'Accept-Encoding': 'gzip',
     'Content-Type': 'application/json' },
  body:
   { query: 'my query (see above)',
     params: [ [ '10.244.200.50' ], [ '10.5.4.1' ] ],
     format: 'array',
     includeColumns: true } }

But I get a Bad Request error. 
How can I use parameters in my query? What am I doing wrong?

You must sign in to leave a comment.