SEVEN THINGS YOU CAN DO TO LEAD A GREENER LIFE
  • Walk_the_walk_off
  • Stay_grounded_off
  • All_consuming_off
  • Easy_on_the_meat_off
  • Human_heat_off
  • Plug_out_off
  • Stick_with_what_you_got_off
Home > Green Thing Labs > Reports Api >

Green Thing Labs

Report API

Reporting offensive content

A user can report offensive content within the system. Content can also be reported anonymously. This is possible for Stories, Comments and Content. To report on an object:

URL: http://www.dothegreenthing.com/reports

Method: POST

Authentication not required

The POST body should be an XML document. Both the Accept and Content-Type headers in the request should be set to "text/xml". An example document follows:

      <?xml version="1.0" encoding="UTF-8"?>
      <report>
        <type>Story</type>
        <id>22076</id>
      </report>
    
Tag Description Required?
Id The id of the object Yes

An empty "201 Created" response will be returned.

The following Ruby code demonstrates how to report a Story object.
      #!/usr/bin/env ruby

      require 'net/http'
      require 'rubygems'
      require 'activesupport'

      report = {}
      report[:type] = "Story" # Could be "Comment" or "ContentItem"
      report[:id] = 22076

      # Do HTTP POST
      url = URI.parse('http://www.dothegreenthing.com/reports')
      req = Net::HTTP::Post.new(url.path)
      req['Accept'] = "text/xml"
      req['Content-Type'] = "text/xml"
      req.body = report.to_xml :root => 'report'
      http = Net::HTTP.new(url.host, url.port)
      http.set_debug_output($stdout)
      res = http.start do |x|
        x.request(req)
      end
      case res
        when Net::HTTPCreated
          puts "OK: report was created"
        else
          res.error!
      end
    
Latest from the Green Thing Blog:
Do The Green Thing's guide to Valentine's Day | (Image: favim)  It's almost Valentine's Day and if you haven't got your...