ruby on rails - string interpolation in Get URI with httparty issue -




so using splunk rest api generate search id thorugh post , search results through request.

i using httpparty, & post , request follows:

  def sid     self.class.post(       "/services/search/jobs",       headers: {'content-type' => 'application/json'},       basic_auth: @auth     ).parsed_response   end 

the generated sid looks this:

1503402217.608

i make necessary request follows:

 def results(sid)    self.class.get(     "/services/search/jobs/#{sid}/results/",     headers: {'content-type' => 'application/json', 'accept' => 'text/html'},     basic_auth: @auth   )     end 

the above request gives 204 no content. if manually paste sid in code , run it, results back.

for eg: "/services/search/jobs/1503402217.608/results/"

so question how can interpolate above results back.

edit: dyamic request looks in console:

<- "get /services/search/jobs/1503402217.608/results/ http/1.1\r\ncontent-type: application/json\r\naccept: text/html\r\nauthorization: basic something==\r\nconnection: close\r\nhost: server:8089\r\n\r\n" -> "http/1.1 204 no content\r\n" -> "date: tue, 22 aug 2017 11:43:37 gmt\r\n" -> "expires: thu, 26 oct 1978 00:00:00 gmt\r\n" -> "cache-control: no-store, no-cache, must-revalidate, max-age=0\r\n" -> "content-length: 0\r\n" -> "vary: cookie, authorization\r\n" -> "connection: close\r\n" -> "x-frame-options: sameorigin\r\n" -> "server: splunkd\r\n" -> "\r\n" 

edit: know, how parsing sid in first place before sending argument request:

sid.parsed_response["sid"]





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -