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