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
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 need to make a SOAP request using curl through VPN. The end point only allow call through VPN.
I have created a VPN and through it I am successfully able to hit the endpoint, But when I try to call it and send xml it returns me error
192.168.11.11 is my VPN
ssh root#192.168.11.11 curl \
--header "Content-Type:text/xml" \
--header "SOAPAction:GenericAPIRequest" \
--header "charset=UTF-8" \
--data "#call.xml" \
"http://10.xxx.xx.xx:8080/xxxxx/xxxx/xxxxxxxx"
call.xml is in the same directory from where I'm hitting curl request
It return me error "Warning: Couldn't read data from file "call.xml", this makes an empty POST."
This curl warning means that it could not fopen the file supplied.
The SSH command may be executing from root's home in /root, so ensure the file is there and that it is readable. You may want to use an absolute path.
Just to be clear, that curl command is executing on the remote side, so call.xml must be located on 192.168.11.11, and not in the directory on the client side where the ssh command is being executed from.
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.
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.
What is the difference between this two curl calls:
curl -X POST -d "/path/file.txt" http://api-path
curl -X POST -d "#/path/file.txt" http://api-path
The first form sends the string "/path/file.txt" as data, probably not what you want. The # makes curl interpret it as a filename to read from. See http://curl.haxx.se/docs/manpage.html, search for the "--data" option.