Questions tagged [unirest]

Unirest is a set of lightweight HTTP libraries available in PHP, Ruby, Python, Java, Objective-C.

Unirest is a set of lightweight HTTP libraries available in PHP, Ruby, Python, Java, Objective-C.

More Details

354 questions
38
votes
6 answers

java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE from Mashape Unirest in Java application

I have a Maven Java project that uses Mashape Unirest for sending HTTP requests to other URLs. I am currently writing an integration test (using TestNG) that sends a normal HTTP request using Unirest. When I run the integration test through Maven…
ecbrodie
  • 11,246
  • 21
  • 71
  • 120
30
votes
7 answers

How to parse JSON results from Unirest call

I'm using the Unirest library to retrieve JSON from a Mashape API. I have the call working using the following code: HttpResponse request = Unirest.get(URL) .header("X-Mashape-Authorization", MASHAPE_AUTH) .asJson(); This returns my…
user1636130
  • 1,615
  • 5
  • 29
  • 47
15
votes
5 answers

how to make Unirest(java) ignore certificate error

I am using Unirest (java version) to make GET and POST request.But I encounter a problem when accessing SSL encrypted site , since my program is behind a corporate network and the network admin setup a firewall mapping for me. For example foobar.com…
Allan Ruin
  • 5,229
  • 7
  • 37
  • 42
11
votes
1 answer

Auth with Unirest JAVA

I need to execute a request to a web app that execute a patch process. I'm giving to this request the parameters it is requesting me, but i do not know how to pass the credentials from a login request i'm executing before the patch request. I'm…
JuanToroMarty
  • 484
  • 6
  • 17
10
votes
2 answers

How can I get a List of objects using Unirest for Java?

I can use Unirest to get an object of my own class like this: HttpResponse itemResponse = Unirest.get("http://localhost:8080/item").asObject(Item.class); I can also set the type parameter to List, which does give me a list of hash maps, but…
user377628
9
votes
3 answers

No serializer found for class java.io.ByteArrayInputStream

I am getting the below error message while getting the user entity from the openfire rest api. ( I am wrapping the my Api Endpoints with openfire Restapi Endpoints.) "error": "Internal Server Error", "exception":…
abdul
  • 101
  • 1
  • 1
  • 3
9
votes
1 answer

Get native REST service error in Unirest

We are using Unirest as REST client. Below is the sample code using which we are invoking REST service HttpResponse response = Unirest .post(url) .header(HEADER_CONTENT_TYPE, HEADER_VALUE_APPLICATON_JSON) .body(payload) …
sag
  • 5,333
  • 8
  • 54
  • 91
7
votes
1 answer

Getting "java.lang.NoClassDefFoundError: org/apache/http/nio/reactor/IOReactorException"

I'm trying to use a Mashape api, I have added the following libraries (jars) unirest, httpasyncclient, httpclient, httpmime, org.json, commons-longging, httpcore to my project. I'm trying to run... HttpResponse response =…
OneTwo
  • 2,291
  • 6
  • 33
  • 55
6
votes
3 answers

Getting ERR_FS_FILE_TOO_LARGE while using unirest file send with put

I am using unirest to upload a file like so unirest.put(fullUri) .auth({ user: self.userName, pass: self.password }) .header('X-Checksum-Sha1', sha1Hash) .header('X-Checksum-Md5', md5Hash) …
parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85
6
votes
1 answer

Unirest Thread Leak

My web app seems to be running out of memory which I think is due to a thread leak. It seems that threads are being stuck at waiting and this grows larger and larger until the memory reaches the top of the heap size. The thread size increases on my…
Stefza
  • 247
  • 3
  • 18
5
votes
1 answer

Node: Express: How to handle application/octet-stream;charset=;UTF-8 response?

I have a node-express application. There, I'm trying to make a call to an API which is responding an raw xlsx object as 'Content-Type' : 'application/octet-stream;charset=;UTF-8' Code how I'm calling the API: var unirest =…
anij
  • 1,322
  • 5
  • 23
  • 39
5
votes
1 answer

How to set credentials for Unirest proxy?

Documentation for Unirest about proxy settings mentions to use: Unirest.setProxy(new HttpHost("127.0.0.1", 8000)); Since the proxy I'm using requires authentication I would need to specify the credentials too but I don't see how.
Luca S.
  • 1,132
  • 2
  • 16
  • 31
5
votes
3 answers

Get full HTTP request

For debugging matters, I would like to get the request executed by Unirest-Java when presented with a set of options. How can I get this: POST / HTTP/1.1 Host: www.some.host.tld Connection: keep-alive Accept:…
Délisson Junio
  • 1,296
  • 4
  • 21
  • 43
4
votes
0 answers

createReadStream() using an in-memory file (Multer memoryStorage)

I'm trying to send a multipart/form-data image to another server, using unirest. Their .attach() works with a fs.createReadStream(), however, I have not been able to convert the buffer to an image. The logical step is to convert the buffer to…
sk0g
  • 43
  • 6
4
votes
3 answers

How to convert curl call with "-i --upload-file" into java Unirest or any other http request?

The example below uses cURL to upload image file included as a binary file. curl -i --upload-file /path/to/image.png --header "Authorization: Token" 'https://url....' It works fine. I need to make this request from my Java application. I have…
1
2 3
23 24