rest-client

Receive Image as multipart file to rest service

馋奶兔 提交于 2021-02-18 18:13:42
问题 I am exposing a restful webservice, where i want to accept image as multipart file in the json body request i dont find anywhere a sample json request so as to hit my rest service from a rest client.my rest service uses this field above the class declaration @Consumes({MediaType.APPLICATION_JSON,MediaType.MULTIPART_FORM_DATA}) can anyone please get me a sample json request 回答1: The purpose of multipart/form-data is to send multiple parts in one request. The parts can have different media

Receive Image as multipart file to rest service

穿精又带淫゛_ 提交于 2021-02-18 18:12:21
问题 I am exposing a restful webservice, where i want to accept image as multipart file in the json body request i dont find anywhere a sample json request so as to hit my rest service from a rest client.my rest service uses this field above the class declaration @Consumes({MediaType.APPLICATION_JSON,MediaType.MULTIPART_FORM_DATA}) can anyone please get me a sample json request 回答1: The purpose of multipart/form-data is to send multiple parts in one request. The parts can have different media

“Unable to connect to the remote server” when I call a rest Api

情到浓时终转凉″ 提交于 2021-02-11 13:22:11
问题 I am getting Unable to connect to the remote server response when I call a rest API var client = new RestClient { BaseUrl = new Uri(ConfigurationManager.AppSettings["WalletUrl"]) }; var hgh = ConfigurationManager.AppSettings["GetWalletRequest"]; var requests = new RestRequest(Method.POST) { RequestFormat = DataFormat.Json }; requests.AddHeader("content-type", "application/json"); requests.AddParameter("application/json", req, ParameterType.RequestBody); requests.AddBody(req); var response =

Ruby RestClient to access Rational Team Concert (RTC) REST

六眼飞鱼酱① 提交于 2021-02-08 08:45:22
问题 I want to use the Ruby gem RestClient to access records from Rational Team Concert (RTC) over REST URLs. I have done this successfully with other servers. When I use the REST URL in Chrome directly, I can get a record. However, when I use my Ruby code, I get back some page that includes a line: net.jazz.ajax._appPath = "/ccm0001001/auth/authrequired"; I've tried all sorts of ways to pass the credentials, but nothing seems to work. This is what I want to use: response = RestClient::Request.new

encoder function for multipart/form-data in groovy

心已入冬 提交于 2021-02-07 20:30:33
问题 I need to form a 'multipart/form-data' REST request with jpeg image and JSON file as the content.I am stuck with encoding the 'multipart/form-data' as a zip file. Can someone tell me, how I can achieve this with groovy RESTClient? I could not find any documentation regarding this. 回答1: As it can be seen in the docs RESTClient extends HTTPBuilder . HTTPBuilder has a getEncoder method that can be used to add dedicated encoder (with type and method). See the following piece of code: import org

how to pass client credentials in postman?

主宰稳场 提交于 2021-02-07 03:41:38
问题 This curls works fine curl acme:acmesecret@localhost:9999/uaa/oauth/token -d "password=password&username=user&grant_type=password" -H "Accept: application/json" In this curl, acme and acmesecret are client credentials used by application to authenticate with authorization server running in localhost:9999 I am trying to make the same request using postman (rest client for chrome). Here is the screen shot (I entered credentials in Basic Auth tab) Here is the preview of the request that is sent

how to pass client credentials in postman?

ぐ巨炮叔叔 提交于 2021-02-07 03:40:41
问题 This curls works fine curl acme:acmesecret@localhost:9999/uaa/oauth/token -d "password=password&username=user&grant_type=password" -H "Accept: application/json" In this curl, acme and acmesecret are client credentials used by application to authenticate with authorization server running in localhost:9999 I am trying to make the same request using postman (rest client for chrome). Here is the screen shot (I entered credentials in Basic Auth tab) Here is the preview of the request that is sent

Extracting JSON from response as ResponseEntityProxy{[Content-Type: application/json;charset=UTF-8,Chunked: true]}

荒凉一梦 提交于 2021-01-29 14:00:14
问题 I am trying to upload file to an url, and have received instead of regular JSON string response, only ResponseEntityProxy{[Content-Type: application/json;charset=UTF-8,Chunked: true]} . As I understood, there is JSON string as a response in there and I need to extract it somehow. Here is my code what I have tried so far to do (this is in the method where I am uploading file to an url): public String uploadDocument() { String responseMsg="empty"; try(CloseableHttpClient client = HttpClients

Error: :Received fatal alert: handshake_failure:javax.net.ssl.SSLHandshakeException, While connecting to the elasticsearch using java REST client

☆樱花仙子☆ 提交于 2021-01-28 09:14:35
问题 java-version: 1.8 elastic-version: 7.10 ubuntu: 18.04LTS I am trying to connect to the elasticsearch using java, we already setup the security in elastic by using xpack security and elastic is password protected and working fine but problem occurs when I try to establish secure elastic connection using java. NOTE: Elasticsearch and java both are in different linux machine. I added these parameter in elasticsearch.yml cluster.name: la-test-elastic-2 network.host: 0.0.0.0 http.port: 9200 xpack

Quarkus Rest Client and OAuth2

我与影子孤独终老i 提交于 2020-08-07 17:46:19
问题 I have a secured micro service that is calling another secured micro service. Both services have service accounts in Keycloak. How can I configure the 1st service to automatically obtain access token from keycloak when calling the 2nd service? It's a simple service to service communication. Does the Quarkus Rest client have an API to do this? If not, how can I do that with the vert.x rest client? 回答1: I was able to make this work by extending the javax.ws.rs.client.ClientRequestFilter.