Created
January 18, 2022 06:46
-
-
Save ddikman/c673b1763fedbc985e359707e9356059 to your computer and use it in GitHub Desktop.
在庫連携するためのRuby例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
File.open("MY_CSV_FILE.csv") do |csv_file| | |
uri = URI.parse('https://api.facy.jp/integration/inventory') | |
req = Net::HTTP::Post.new(uri.path) | |
req["X-Api-Key"] = "MY_KEY" | |
req.set_form([["file", csv_file]], "multipart/form-data") | |
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http| | |
http.request(req) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment