Following this (I think accurately):
https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/grpc_json_transcoder_filter
I'm following the configuration in the documentation and my gRPC service is on :50051 and the gRPC-JSON Transcoder is listening on :51051.
I'm able to submit gRPC requests against the transcoder:
grpcurl \
--plaintext \
--import-path=${HELLOWORLD} \
--import-path=${GOOGLEAPIS} \
--proto=helloworld/helloworld.proto \
-d '{"name":"Freddie"}' \
:51051 \
helloworld.Greeter/SayHello
{
"message": "Hello Freddie"
}
But I'm unable to determine how to correctly submit REST requests to it:
curl \
--request GET \
--header "Content-Type: application/json" \
--data '{"name":"Freddie"}' \
http://0.0.0.0:51051/helloworld.Greeter/SayHello
curl \
--header "Content-Type: application/json" \
--data '{"name":"Freddie"}' \
http://0.0.0.0:51051/say
curl \
--request GET \
--header "Content-Type: application/json" \
http://0.0.0.0:51051/say?name=Freddie
I've tried with|without headers, with --insecure and https, using --request POST and --request GET all with no success.
All result in:
upstream connect error or disconnect/reset before headers. reset reason: remote reset
Would appreciate guidance on debugging this type of issue too. Envoy logs nothing to stdout correponding to these requests and the admin console includes no (obvious) explanation either.
Thanks!
Hmmm... I repro'd the solution on a different machine and it works:
Working variants:
curl \
--header "Content-Type: application/json" \
http://localhost:51051/say?name=Frederik
{
"message": "Hello Frederik"
}
curl http://localhost:51051/say?name=Frederik
{
"message": "Hello Frederik"
}
Non-working (incorrect) variants:
curl \
--header "Content-Type: application/grpc" \
http://localhost:51051/say
curl \
--data '{"name":"Henry"}' \
http://localhost:51051/say
upstream connect error or disconnect/reset before headers. reset reason: remote reset
Related
How can I send a request like this with the REST library in the robot?
curl --location --request POST 'https://x/api/oauth/token' \
--header 'Authorization: y' \
--form 'username="user"' \
--form 'password="passw"' \
--form 'grant_type="grant"'
I have a curl put request that I can use some unix command to see the stdout and stderr from.
If I add the line 2>&1 | grep -v "Authorization" At the end of my curl request, I can see the verbose output from my curl in my CLI minus a line that starts with "Authorization"
I tried creating a function with the above command, but when I call that function at the end of my curl request (like below) it no longer removes the "Authorization" line.
function remove_item_from_verbose {
2>&1 | grep -v "Authorization"
}
echo -e "\n +++ Creating '$TENANT' tenant:\n"
# Create tenant
curl -L -X PUT "http://localhost:$HOST_PORT/admin/v2/tenants/$TENANT" \
--verbose \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $AUTHORIZATION" \
--data-raw "{\"allowedClusters\": [\"$CLUSTER\"]}" remove_item_from_verbose
AFAIK functions do work like that. What you are trying to so is add extra details to your command. You can do it like that:
#!/bin/bash
remove_item_from_verbose="2>&1 | grep -v \"Authorization\""
echo -e "\n +++ Creating '$TENANT' tenant:\n"
# Create tenant
eval curl -L -X PUT "http://localhost:$HOST_PORT/admin/v2/tenants/$TENANT" \
--verbose \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $AUTHORIZATION" \
--data-raw "{\"allowedClusters\": [\"$CLUSTER\"]}" "$remove_item_from_verbose"
Like this, $remove_item_from_verbose becomes a suffix of your command.
Note the addition of eval in front of curl, it is required to have this suffix treated as part of the command.
The latest update of the POSTMAN (7.16) doesn't seem to understand the cURL when importing them.
Here is a cURL exported by POSTMAN itself via the "Code" option.
curl -L -X POST 'https://example.com/example/' \
-H 'Content-Type: application/json' \
--data-raw '{
"requestFields":{
"address":"123, Main Street",
"ping":false
}
}'
But when this cURLis is tried to be imported to POSTMAN again, it doesn't populate the Body area of the request.
Is there a workaround?
I am trying to set setCustomClaims on a user
with curl. Is it possible?
So far I got this
curl 'https://identitytoolkit.googleapis.com/v1/accounts:setCustomClaims?key=[API_KEY]' \
-H 'Content-Type: application/json' \
--data-binary '{"email":"[user#example.com]","password":"[PASSWORD]"}'
Looks like Airflow has an experimental REST api that allow users to create dag runs with https POST request. This is awesome.
Is there a way to pass parameters via HTTP to the create dag run? Judging from the official docs, found here, it would seem the answer is "no" but I'm hoping I'm wrong.
I had the same issue. "conf" value must be in string
curl -X POST \
http://localhost:8080/api/experimental/dags/<DAG_ID>/dag_runs \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{"conf":"{\"key\":\"value\"}"}'
Judging from the source code, it would appear as though parameters can be passed into the dag run.
If the body of the http request contains json, and that json contains a top level key conf the value of the conf key will be passed as configuration to trigger_dag. More on how this works can be found here.
Note the value of the conf key must be a string, e.g.
curl -X POST \
http://localhost:8080/api/experimental/dags/<DAG_ID>/dag_runs \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{"conf":"{\"key\":\"value\"}"}'
This is no longer true with the stable REST API.
You can do something like -
curl --location --request POST 'localhost:8080/api/v1/dags/unpublished/dagRuns' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw '{
"dag_run_id": "dag_run_1",
"conf": {
"key": "value"
}
}'
I understand that the question is asked for experimental API but this question is the top search result for airflow REST API.