I would like to replicate the CouchDB database https://github.com/kirel/detexify-data
Sadly, I get an error:
$ curl -X POST -H "Content-Type:application/json" -d '{"source":"https://kirelabs.cloudant.com/detexify","target":"detexify"}' http://localhost:5984/_replicate
{"error":"checkpoint_commit_failure","reason":"Failure on source commit: {error,<<\"unauthorized\">>}"}
This seems to be the following error: https://issues.apache.org/jira/browse/COUCHDB-1524
Can anybody please tell me if there is a work-around? How can I get the data?
Failed tries
$ curl -X POST -H "Content-Type:application/json" \
-d '{"source":"https://kirelabs.cloudant.com/detexify",
"target":"detexify",
"use_checkpoints":false}'
http://localhost:5984/_replicate
{"error":"checkpoint_commit_failure",
"reason":"Failure on source commit: {error,<<\"unauthorized\">>}"}
Well a quick easy solution is to not use checkpoints.
{"source":"https://kirelabs.cloudant.com/detexify","target":"detexify","use_checkpoints":false}
I tried it with this request and managed to replicate your data.
Update
Well I tried it again and replication seems to be working fine for me. I replicated 22.7 mb of data before cancelling the replication. I have attached a screenshot.
curl -X POST -H "Content-Type:application/json" -d '{"source":"https://kirelabs.cloudant.com/detexify",
"target":"detexify",
"use_checkpoints":false,"create_target":true}' http://ABBA:dancing-queen#localhost:5984/_replicate
The replication command was copied verbatim from your updated example except for the "create_target" option and admin basic authentication on my local database.
Related
I am trying to run an Azure DevOps pipeline from the windows command prompt using curl.
Based on Microsoft documentation ( Runs - Run Pipeline ) I should be able to run a pipeline by posting:
https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1
I am able to GET using the command:
curl -u :<PAT> https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1
However, I can't figure out how to do a POST for DevOps using curl to run the pipeline.
I have tried the following:
curl -s -X POST -L https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1 -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic <PAT>"
But this returns the error
HTTP Error 411. The request must be chunked or have a content length
I managed to solve my problem which consisted of numerous steps:
Log the API call from the DevOps website to get the correct format of the json-body ( See this question ).
Format the json-body with extra double quotation signs.
Use the {project}-id instead of the ascii-name since it included a special character which the command prompt misinterpret.
Hence the complete curl command was:
curl -X POST -u :<PAT> "https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1" -H "Content-Type: application/json" -d "{""stagesToSkip"": ""[]"", ""resources"": {""repositories"": {""self"": {""refName"": ""refs/heads/master""}}}}"
I'm trying to explore the curl connect or retrieve the data with query API link but when I run my GET command in curl it runs without any error shown in -vv but the process stop. below the actual statement at the end of the posted process, may I know if this is normal or I need to add an additional arguments or parameters on my command for me to retrieve the data? If yes may I know how to do it?
Connection #1 to host myserver.com left intact
My command
curl -vv -k -X GET -H --user user123:password1 -H "Accept: application/json" https://myapplink/statement/EXE=sample
I am trying to reindex solr in one of our crafter delivery node with curl command
curl "http://{hostname}:{port}/api/1/target/deploy/{environment}/{siteName}" -X POST -H "Content-Type: text/json" -d '{ "reprocess_all_files": true }'
And changing the curl command URL as per our configuration but I am getting an error "{"message":"Content type 'text/json;charset=UTF-8' not supported"}"
Any suggestion will be much appreciated.
The content type seems to be wrong, it should be application/json, not text/json. The documentation seems to have an error.
I have two machines lets say 156 and 157
I have a db in 156 machine which i want to replicate to 157 machine for that i am using the following command
curl -X POST -d '{"source":"http://couch_user:couch_password#XX.XX.XX.156:5984/root_openwhisk-156_whisks","target":"http://couch_user:couch_password#XX.XX.XX.157:5984/root_openwhisk-156_whisks"}' http://couch_user:couch_password#XX.XX.XX.156:5984/_replicate -H "Content-Type: application/json"
also i tried without password
curl -X POST -d '{"source":"http://XX.XX.XX.156:5984/root_openwhisk-156_whisks","target":"http://XX.XX.XX.157:5984/root_openwhisk-156_whisks"}' http://XX.XX.XX.156:5984/_replicate -H "Content-Type: application/json"
but i am getting below error
{"error":"db_not_found","reason":"could not open http://XX.XX.XX.156:5984/root_openwhisk-156_whisks/"}
I have also tried the replicator utility in futon but that also doesn't work
In the Futon i can see root_openwhisk-156_whisks along with _replicator and _user in both machine
Kindly help
The source should be just root_openwhisk-156_whisks without the http protocol, IP and login credentials. Example from the official documents: http://guide.couchdb.org/draft/replication.html
I've been having trouble acquiring and changing some of the basic data available from the Nest thermostat.
Using a command line, how can I get or change individual settings or values on my thermostat?
This is a compilation from several users explaining how to retrieve or change some basic information with some of my own experiences added in. Wherever I use <VALUE>, replace that with the applicable information in your setup. If you're using Windows, you'll need something like git-scm.
The following a part of the authentication process. You'll need to have a client already made on Nest's developer page and followed the provided authorization URL to get your auth code. Run this line to get an access token:
curl --data 'code=<AUTH CODE>&client_id=<CLIENT ID>&client_secret=<CLIENT SECRET>&grant_type=authorization_code' https://api.home.nest.com/oauth2/access_token
To fetch some information about the thermostats associated with the authorization code:
curl -v -L https://developer-api.nest.com/devices/thermostats?auth=<AUTH CODE>
To fetch some information about a specific thermostat:
curl -v -L https://developer-api.nest.com/devices/thermostats/<THERMOSTAT ID>?auth=<AUTH CODE>
To fetch the target temperature in F from the specified thermostat. You can replace target_temperature_f with any other value listed under thermostat on Nest's API reference:
curl -v -L https://developer-api.nest.com/devices/thermostats/<THERMOSTAT ID>/target_temperature_f?auth=<AUTH CODE>
To change the target_temperature_f:
curl -v -L -X PUT "https://developer-api.nest.com/devices/thermostats/<THERMOSTAT ID>/target_temperature_f?auth=<AUTH CODE>" -H "Content-Type: application/json" -d "65"
To change the specific structure to away. The value here is a string so be sure to include the single quotes:
curl -v -L -X PUT "https://developer-api.nest.com/structures/<STRUCTURE ID>/away?auth=<AUTH_TOKEN>" -H "Content-Type: application/json" -d '"away"'
Credit for this is primarily to the following users:
thesimm, mccv, Nagesh Susarla, and David W. Keith.