I want to update actual value for some Objective Key Result.
I am using following curl-
curl --location -g --request POST 'https://rally1.rallydev.com/slm/webservice/v2.0/keyresultactualvalue/{Key Result UUID}' \
--header 'zsessionid: xxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=gc-app-xxxxxxxxxxxxxxxxxxx.gc-app-18; SERVERID=xxxxxxxxxxxxxxxxxxxxx; SUBBUCKETID=100; SUBSCRIPTIONID=100; __cflb=xxxxxxxxxxxxxxxxxxxxxx; _username=test#ktestlera.io' \
--data-raw '{
"KeyResultActualValues":{
"Date":"2023-10-10",
"ActualValue":"100"
}
}'
But I am getting error:
{
"OperationResult": {
"_rallyAPIMajor": "2",
"_rallyAPIMinor": "0",
"Errors": [
"Cannot parse number: For input string: \"ObjectReference[oid=null, type=null]\""
],
"Warnings": []
}
}
I am sure that I am sending wrong request body.
Please help me in that.
I am having trouble with the addNameserversToDomain call. Every time I try to execute it I receive the error:
{
"error": "Object does not exist to execute method on. (SoftLayer_Dns_Domain_Registration::addNameserversToDomain)",
"code": "SoftLayer_Exception"
}
URL :
https://api.softlayer.com/rest/v3.1/SoftLayer_Dns_Domain_Registration/addNameserversToDomain.json
CURL Request
curl --location --request GET 'https://api.softlayer.com/rest/v3.1/SoftLayer_Dns_Domain_Registration/addNameserversToDomain.json' \
--header 'Authorization: {{AuthToken}}' \
--header 'registrationInitParameters: true' \
--header 'Content-Type: application/json' \
--data-raw '{
"nameservers": [
"aa.com"
]
}'
I'm issuing the following request:
curl --http2 -X "POST" "http://localhost:8088/query-stream"
-H "Content-Type: application/vnd.ksql.v1+json; charset=utf-8"
-d $'{
"sql": "SELECT * FROM USERS EMIT CHANGES;",
"streamsProperties": {
"ksql.streams.auto.offset.reset": "earliest"
}
}
The result I'm getting is:
{"queryId":"cdfb3ccc-0ab5-4186-a249-b279bfc09587","columnNames":["USERID","NAME"],"columnTypes":["STRING","STRING"]}
["1","Max"]
["2","Alex"]
["13","Andrew"]
...
Is there a way I could get the data in json format?
{"userid":"1","name":"Max"}
{"userid":"2","name":"Alex"}
{"userid":"13","name":"Andrew"}
It is easier to deserialize this data into POCO objects if they are in json than to parse the 'row' format.
Per the docs you can set the Accept header. It defaults to application/vnd.ksqlapi.delimited.v1 but can also be set to application/json:
curl --show-error --silent \
-H "application/vnd.ksqlapi.delimited.v1" \
--http2 'http://localhost:8088/query-stream' \
--data-raw '{"sql":"SELECT * FROM CUSTOMERS WHERE ID=42;"}'
{"queryId":null,"columnNames":["ID","FIRST_NAME","LAST_NAME","EMAIL","GENDER","COMMENTS"],"columnTypes":["INTEGER","STRING","STRING","STRING","STRING","STRING"]}
[42,"Rick","Astley","r.astley#example.com","Male",""]
curl --show-error --silent \
-H "Accept:application/json" \
--http2 'http://localhost:8088/query-stream' \
--data-raw '{"sql":"SELECT * FROM CUSTOMERS WHERE ID=42;"}'
[{"queryId":null,"columnNames":["ID","FIRST_NAME","LAST_NAME","EMAIL","GENDER","COMMENTS"],"columnTypes":["INTEGER","STRING","STRING","STRING","STRING","STRING"]},[42,"Rick","Astley","r.astley#example.com","Male",""]]
I am using groovy execute API in Jenkins pipeline code to execute the curl command, I am getting response from the rest API, but I am not able to retrieve HTTP code.
How to retrieve the HTTP code from groovy curl execute method.
node{
stage("api")
{
getApi()
}
}
def getApi()
{
def process = ['bash', '-c',"curl -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'Authorization: Bearer oosfjwejowjefojwoejfowoefjwojefwefweofjwo' https://myrest.api.com"].execute()
process.waitFor()
println (process.err.text)
println (process.text)
}
def http_code = sh(
returnStdout: true,
label: "checking myrest.api.com",
script: """curl -X GET --header 'Content-Type: application/json' \
--header 'Accept: application/json' \
-H 'Authorization: Bearer oosfjwejowjefojwoejfowoefjwojefwefweofjwo' \
https://myrest.api.com -o /dev/null -w '%{http_code}'"""
).trim()
I am sending a curl command to a server, but get an error message which I do not understand.
The request I need to send to the server is
body=$(cat << EOF
{
"order": {
"units": "100",
"instrument": "EUR_USD",
"timeInForce": "FOK",
"type": "MARKET",
"positionFill": "DEFAULT"
}
}
EOF
)
curl \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer TOKEN>" \
-d "$body" \
"https://api-fxtrade.oanda.com/v3/accounts/<ACCOUNT>/orders"
What I do is that I translate this into a curl command like :
curlcmd = 'curl -s \ -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer " \ -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" \ "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"'
I send the command via resp = system (curlcmd) via Matlab to the server. What I get as an error message is :
errorMessage: 'Invalid JSON, ParseErrorCode: 4, Message: Missing a name for object member.'
Any idea what this means and how I can solve this ? I am using Matlab on Windows 10, so curl is part of Windows 10.
Response should be a placed order and response data of the trade.
The JSON doesn't seem to be properly quoted.
Try this:
curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{\"order\": {\"units\": \"100\", \"instrument\": \"EUR_USD\", \"timeInForce\": \"FOK\", \"type\": \"MARKET\", \"positionFill\": \"DEFAULT\" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"
Test with Proxy
With the appropriate escape of the JSON quotes, as shown in the above CURL command line, the JSON looks correct when viewed in an HTTPS proxy: