KSQLDB REST API content-type missing - rest

I'm executing a pull query against my ksqldb rest endpoint and use it in another application.
Using postman, i get the results, but can't use them in the calling application.
Reason is that ksqldb doesn't set "content-type" in response.
The calling application needs "Content-Type: application/json" in the response to recognise as JSON.
In the header i tried "Accept: application/vnd.ksql.v1+json" and also "Accept: application/json".
The ksqldb-rest-api documentation says that the response contains the "content-type" but it doesn't.
I'm using ksqldb Version 0.24.0.
Is there a way to get content-type in the response?

Related

How to authenticate with TestRail API?

I'd like to use the TestRail API, but I am having authentication issues. I setup a Postman to play with the API and query it like:
https://my.testrail.io/index.php?/api/v2/get_users
I saw another SO question that used the Authorization header with basic authentication so I added that:
Authorization: Basic myemail#whatever.com:apikey
When I tried running this I got:
{
"error": "Authentication failed: invalid or missing user/password or session cookie."
}
I've also tried replacing the API key with my password, but that didn't work either. The cURL command generated by Postman is:
curl --location --request GET 'https://my.testrail.io/index.php?/api/v2/get_users' \
--header 'Authorization: Basic <EMAIL>:<APIKEY>' \
--header 'Cookie: tr_session=<GUID>'
I can go to https://my.testrail.io/index.php?/api/v2/get_users in my browser after logging in to TestRail and that does work.
You need to either add your email/key via "Authorization" tab in Postman or you need to encode them by yourself and put into "Authorization" header (Postman can do it for you when you use "Authorization" tab)

How do you send an authorization header to a REST API from the copy task of an azure data factory pipeline?

I am trying to create an Azure data factory to copy data from an API to blob storage. The problem I'm encountering is getting the authorization to work. The API requires a token whose value we already have. The curl for the API is:
curl -X GET "https://zentracloud.com/api/v3/get_env_model_data/?device_sn=<value>&model_type=<value>&port_num=<value>
&inputs=<value>" -H "accept: application/json" -H "Authorization: Token <token>"
I've tried putting the Authorization into the auth headers of the Linked Service
and in the additional headers of the source of the Copy Data task
When I click "Preview Data" I get an "invalid credentials" error, which tells me either I'm not putting the authentication headers in the right place or my format is incorrect. I'm not sure how to get this thing to work.
I contacted Microsoft and was told that they don't support validation via a token.

How to use Curl to make a POST request with Dropwizard

I have Dropwizard backend end and like to use curl to make a POST request with a Json body
I used Postman with the settings on the body tab raw radio button selected and on the drop down menu JSON(applicattion/json).I entered the body and was able to successfully create a POST request.
However when I used curl I get an error. I used
curl -v -X POST "localhost:8080/resource"
-H "Content-Type: application/json"
-d '{label1: "words1", label2: "words2"}'
I get the error message
{"code":400,"message":"Unable to process JSON"}
From my understanding it is curl that has an issue since Postman was able to create the POST request.
This
{label1: "words1", label2: "words2"}
is not JSON. Use
{"label1": "words1", "label2": "words2"}

Uber Rush API Sandbox

Trying to test Uber Rush API (from localhost and from linux server).
Calling Token works - I get the token
trying to implement sanbox example:
curl -X "PUT /v1/sandbox/deliveries/{delivery_id}" \
-H "Authorization: Bearer <OAUTH TOKEN>" \
-d "{\"status\":\"en_route_to_pickup\"}"
with url https://sandbox-api.uber.com/
and I tried the same request with file_get_contents (in PHP)
So, I always get error "405 Method Not Allowed"
{"message":"Method not supported for this endpoint.","code":"method_not_allowed"}
What I need to do to get access to method from this sandbox example https://developer.uber.com/docs/rush/sandbox?
Corrent syntax
curl -X "PUT" -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" -d "{\"status\":\"en_route_to_pickup\"}" https://sandbox-api.uber.com/v1/sandbox/deliveries/DELIVERY_ID
EDIT: Updated to reflect both issues in your question...
You have a mismatch in your requests and an incorrect syntax for curl.
First off your CURL request is incorrectly specified. It should be:
curl -X "PUT" -H "Authorization: Bearer <OAUTH TOKEN>" -d "{\"status\":\"en_route_to_pickup\"}" https://sandbox-api.uber.com/v1/sandbox/deliveries/{delivery_id}
In addition, your curl command is trying to issue a PUT request to the uber sandbox PUT API. However, your PHP code is not setting the context correctly and so is probably issuing a GET request. I suspect that the server is therefore rejecting the request as a GET as not allowed to do this sort of operation.
To fix it, see Bad request using file_get_contents for PUT request in PHP. This should give you an example of how to pass in the necessary context to issue a PUT request using file_get_contents().

POST through SoapUI is unsuccessful, but the same request through DHC is completed successfully

I tested REST services with DHC application for Chrome, and POST requests were successful with these parameters:
DHC_successful_POST
But when I try to create the same request in SoapUI, I always get 500 error. Probably, there should be some other parameters or settings in SoapUI, but I cannot see it. What is wrong? Here is my request:
SoapUI_POST_500_fault
P.S.
In DHC there is such code for my request:
curl -i -X POST \
-H "Content-Type:multipart/form-data" \
-F "file=" \
-F "fileName=rich-text.zip" \
So, I just need to find settings for these parameters in SoapUI (free version).
Are there any suggestions?
As per this (see attachments section)you've to append file: to your parameter value to be able to send the content of file as multipart/form-data