Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

call the api from ruby

# httpx2.rb
require "httpx"

response = HTTPX.post("https://jsonplaceholder.typicode.com/posts", :json => {'title' => 'foo', 'body' => 'bar', 'userID' => 1})
puts response.body if response.status == 201
Comment

call api in ruby

require 'uri'
require 'net/http'

url = URI("https://api.sygictravelapi.com/1.0/en/places/list?parents=city%3A372&level=poi&limit=100")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["x-api-key"] = ENV["SYGIC_API_KEY"]
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
Comment

PREVIOUS NEXT
Code Example
Ruby :: paranoia gem 
Ruby :: height of a tree in ruby 
Ruby :: rails decode cookie 
Ruby :: logback grails log in different files 
Ruby :: rails callback STI 
Ruby :: rails run rake task 
Ruby :: rails fixture without timestamping 
R :: dplyr replace na 
R :: random integer in r 
R :: delete first three lines dataframe R 
R :: how to append in a list in R 
R :: read csv file in r 
R :: merge several data frames in r 
R :: r change row names of a dataframe 
R :: r - change column name 
R :: count word in a string r 
R :: how to read csv file in r 
R :: calculating RMSE, Rsquared with caret in R 
R :: how to change the font of the xlab in plot in r 
R :: repeat sample in r 
R :: dataframe to r code 
R :: rename a variable in r 
R :: run regression for certain groups in r 
R :: R excel 
R :: Levels in factor in r 
R :: L in r 
R :: save data frames in a loop r 
R :: ggplot box plot without outliers poins 
Rust :: bevy assets image as sprite 
Rust :: host rust server 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =