Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7578417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:25:39+00:00 2026-05-30T17:25:39+00:00

I’m failing to send a XML file named filesystem.xml to CouchDB using curl on

  • 0

I’m failing to send a XML file named filesystem.xml to CouchDB using curl on the cmd-line.

I started by creating a new database named my_db :

curl -X PUT http://127.0.0.1:5984/my_db
{"ok":true}

and I’ve tried several ways to upload the xml document to this database so far, including:

curl -vX POST http://127.0.0.1:5984/my_db -H "Content-Type: text/xml" -d @filesystem.xml

which outputs:

* About to connect() to 127.0.0.1 port 5984 (#0)
*   Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)
> POST /my_db HTTP/1.1
> User-Agent: curl/7.21.0 (i386-redhat-linux-gnu) libcurl/7.21.0 NSS/3.12.10.0 zlib/1.2.5 libidn/1.18 libssh2/1.2.4
> Host: 127.0.0.1:5984
> Accept: */*
> Content-Type: text/xml
> Content-Length: 3091
> Expect: 100-continue
> 
< HTTP/1.1 415 Unsupported Media Type
< Server: CouchDB/1.0.2 (Erlang OTP/R14B)
< Date: Thu, 01 Mar 2012 16:18:14 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 78
< Cache-Control: must-revalidate
< 
{"error":"bad_content_type","reason":"Content-Type must be application/json"}
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0

The response from the server says HTTP/1.1 415 Unsupported Media Type, which indicates the problem. How do I fix this?

I just recently started playing with CouchDB and curl so I know I must be missing something obvious. Feel free to elaborate your answer for this newbie.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:25:41+00:00Added an answer on May 30, 2026 at 5:25 pm

    What I found out is that you can’t upload a file directly to the database. Files can only be stored if you ATTACH them to an existing document in the database.

    The following instructions demonstrates what I was trying to do.

    1) Create a dummy document:

    curl -X POST http://localhost:5984/my_db -H "Content-Type: application/json" -d {}
    {"ok":true,"id":"4f674a5b32bbd4e0a97f00817b0006d1","rev":"1-967a00dff5e02add41819138abb3284d"}
    

    2) Upload XML file. You’ll need the id and revision values that were returned by the previous command to do this:

    curl -X PUT http://127.0.0.1:5984/my_db/4f674a5b32bbd4e0a97f00817b0006d1/attachment?rev=1-967a00dff5e02add41819138abb3284 --data-binary @filesystem.xml -H "Content-Type: text/xml"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an XML file, the creators of it stuck in a bunch social
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.