Last active
August 29, 2015 13:56
-
-
Save wzyboy/3c5fdecacb7cfde3fc4b to your computer and use it in GitHub Desktop.
Simple Foursquare Bash utility.
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
#!/bin/bash - | |
# Author: Zhuoyun Wei <wzyboy@wzyboy.org> | |
# Usage: 1. Get your token. | |
# 2. Fill in / replace information below. | |
# 3. Source this file. | |
# 4. `newvenue "某某地铁站 Foobar Metro Station" 120.1234,31.5678` | |
# to add a new venue. Note the order of lat and long. | |
# 5. `addlist VENUEID` to add a venue to your (existing) list. | |
token="" | |
city="Wuxi" | |
state="Jiangsu" | |
category="4bf58dd8d48988d1fd931735" # Subway | |
url="http://www.wxmetro.net/" | |
#listid=5302025211d29a5870b741fe # 无锡地铁1号线 | |
listid=53021baa498eed325e459d56 # 无锡地铁2号线 | |
new_venue() { | |
local name=$1 | |
local longlat=$2 | |
local latlong=$(echo $longlat | awk -v FS=, '{print $2","$1}') | |
curl -F "name=$name" -F "ll=$latlong" \ | |
-F "city=$city" -F "state=$state" \ | |
-F "primaryCategoryId=$category" -F "url=$url" \ | |
-s "https://api.foursquare.com/v2/venues/add?v=20131016&oauth_token=$token" | |
echo | |
} | |
add_list() { | |
local venueid=$1 | |
curl -F "venueId=$venueid" \ | |
-s "https://api.foursquare.com/v2/lists/$listid/additem?v=20131016&oauth_token=$token" | |
echo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment