Created
April 21, 2016 22:39
-
-
Save vivahiraj/2bcf27b526616c5d06a830542cc6507f to your computer and use it in GitHub Desktop.
LINE BOT APIのプロファイル取得のためのAPIを試すものです
This file contains hidden or 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
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
ID = "Channel ID" | |
SECRET = "Channel Secret" | |
MID = "MID" | |
response = RestClient::Request.execute( | |
:method => :get, | |
:url => "https://trialbot-api.line.me/v1/profiles?mids=#{MID}", | |
:headers => {"X-Line-ChannelID" => ID, | |
"X-Line-ChannelSecret" => SECRET, | |
"X-Line-Trusted-User-With-ACL" => MID} | |
) | |
json = JSON.parser.new(response.to_str) | |
hash = json.parse() | |
p hash | |
puts hash["contacts"][0]["displayName"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment