Skip to content

Instantly share code, notes, and snippets.

@jlong
Created May 24, 2012 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlong/2781412 to your computer and use it in GitHub Desktop.
Save jlong/2781412 to your computer and use it in GitHub Desktop.
Creating a forum with the UserVoice API
#! /usr/bin/env ruby
require 'rubygems'
require "oauth"
require 'json'
# Trusted Client
KEY = 'CLIENT KEY'
SECRET = 'CLIENT SECRET'
SITE = 'http://your_subdomain.uservoice.com'
consumer = OAuth::Consumer.new(KEY, SECRET, :http_method => :post)
access_token = OAuth::AccessToken.new consumer
forum = {
"forum[name]" => 'Exciting New Stuff'
}
response = access_token.post("#{SITE}/api/v1/forums.json", forum)
forum_hash = JSON.parse(response.body)
puts forum_hash.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment