title: Node.js - Craigslist bulk post api (Failed to parse rss)
body: <p>I am using the bulk post api for craigslist. I wrote a quick script that looks like this:</p>
  
  <pre><code>var https = require('https');
  var posting = '&lt;?xml version="1.0"?&gt;&lt;rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cl="http://www.craigslist.org/about/cl-bulk-ns/1.0"&gt;&lt;channel&gt;&lt;items&gt;&lt;rdf:li rdf:resource="NYCBrokerHousingSample1"/&gt;&lt;rdf:li rdf:resource="NYCBrokerHousingSample2"/&gt;&lt;/items&gt;&lt;cl:auth username="example@example.com" password="example" accountID="14"/&gt;&lt;/channel&gt;&lt;item rdf:about="NYCBrokerHousingSample1"&gt;&lt;cl:category&gt;fee&lt;/cl:category&gt;&lt;cl:area&gt;nyc&lt;/cl:area&gt;&lt;cl:subarea&gt;mnh&lt;/cl:subarea&gt;&lt;cl:neighborhood&gt;Upper West Side&lt;/cl:neighborhood&gt;&lt;cl:housingInfo price="1450" bedrooms="0" sqft="600"/&gt;&lt;cl:replyEmail privacy="C"&gt;bulkuser@bulkposterz.net&lt;/cl:replyEmail&gt;&lt;cl:brokerInfo companyName="Joe Sample and Associates" feeDisclosure="fee disclosure here" /&gt;&lt;title&gt;Spacious Sunny Studio in Upper West Side&lt;/title&gt;&lt;description&gt;&lt;![CDATA[posting body here]]&gt;&lt;/description&gt;&lt;/item&gt;&lt;item rdf:about="NYCBrokerHousingSample2"&gt;&lt;cl:category&gt;fee&lt;/cl:category&gt;&lt;cl:area&gt;nyc&lt;/cl:area&gt;&lt;cl:subarea&gt;mnh&lt;/cl:subarea&gt;&lt;cl:neighborhood&gt;Chelsea&lt;/cl:neighborhood&gt;&lt;cl:housingInfo price="2175" bedrooms="1" sqft="850" catsOK="1"/&gt;&lt;cl:mapLocation city="New York" state="NY" crossStreet1="23rd Street" crossStreet2="9th Avenue" latitude="40.746492" longitude="-74.001326"/&gt;&lt;cl:replyEmail privacy="C" otherContactInfo="212.555.1212"&gt;bulkuser@bulkposterz.net&lt;/cl:replyEmail&gt;&lt;cl:brokerInfo companyName="Joe Sample and Associates" feeDisclosure="fee disclosure here" /&gt;&lt;title&gt;1BR Charmer in Chelsea&lt;/title&gt;&lt;description&gt;&lt;![CDATA[posting body goes here]]&gt;&lt;/description&gt;&lt;cl:PONumber&gt;Purchase Order 094122&lt;/cl:PONumber&gt;&lt;/item&gt;&lt;/rdf:RDF&gt;'
  
  var options = {
    hostname: 'post.craigslist.org',
    path: '/bulk-rss/validate',
    method: 'POST',
    headers: {
      'Content-Type' : 'application/x-www-form-urlencoded'
    }
  };
  
  var req = https.request(options, function(res) {
    console.log("headers: ", res);
  
    res.on('data', function(d) {
      process.stdout.write(d);
    });
  });
  req.write(posting)
  req.end()
  
  req.on('error', function(e) {
    console.error(e);
  });
  </code></pre>
  
  <p>I am getting a 415 Unsupported Media Type response with the additional message <code>no element found at line 1, column 0, byte -1</code>. The xml is taken straight from their example, so it seems like there shouldn't be a problem parsing the xml, unless there is a problem with how I'm sending the https request.</p>