我有这个curl URL连接到couchDB。
curl -X PUT http://admin:ulacit@13.90.93.32:5984/test/“001”-d'{“name”:“moises”}'
我看到很多关于GET和POST的问题,但我没有找到PUT的例子。
我这样做是正确的吗?
$.ajax({
crossOrigin: true,
url : 'http://admin:ulacit@13.90.93.32:5984/test/'+user,
type : 'POST',
processData: false,
dataType: 'json',
contentType: 'application/json',
data: {pass:pass,email:email},
success:function(result){
if(result!="error"){
alert("Registro Correcto, Proceda a entrar");
open("login.html","_parent" );
}else{
alert("Usuario Ya Utilizado");
}
},
答案 0 :(得分:0)
PUT
HTTP动词用于:
curl -X PUT http://localhost:5984/mydb
# create a document with PUT with document id in the URL
curl -X PUT -d '{"a":1,"b":2}' -H 'Content-type: application/json' http://localhost:5984/mydb/mydocid
{"ok":true,"id":"mydocid","rev":"1-25f9b97d75a648d1fcd23f0a73d2776e"}
相当于:
# create a document with POST with the document id in the body
curl -X POST -d '{"_id":"mydocid","a":1,"b":2}' -H 'Content-type: application/json' http://localhost:5984/mydb/mydocid