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
4
votes
2 answers

How to get raw JSON text from Unirest response in Java

I'm trying to send a POST request to a server, get the response, and parse it (it is a JSON file). I am using Unirest for my POST request, simply as below: HttpResponse response = Unirest …
Tina J
  • 4,983
  • 13
  • 59
  • 125
4
votes
5 answers

How to get Access Token using client_credentials using java code?

I have some API which requires access token to get the response. In postman we use OAuth 2.0 to get the access token by providing client username and password. In a similar way, I want to fetch the new access token. Here is the sample code which I…
avidCoder
  • 440
  • 2
  • 10
  • 28
4
votes
2 answers

Multipart File Upload Request Using Unirest in Java

I am able to post this request using a REST client (Insomnia). However, when I unable to write a proper code to do the same in Java. Below is how my insomnia request looks like. Below is how the code generated by the Client looks…
Bharat Nanwani
  • 653
  • 4
  • 11
  • 27
4
votes
3 answers

Mailgun Java API send HTML emails

I am trying to get "html": "... entire contents of HTML page goes here ..." in Java using Unirest HTTP communication with MailGun API. So far I have verified my domain, successfully sent an email via the API, and successfully sent an HTML (basic)…
flashjpr
  • 470
  • 6
  • 12
4
votes
1 answer

How to Return a Promise from a Unirest PUT Request

I am trying to create a function that returns a promise so it can be chained together and integrated with some other functions. When I try to run, I get the following error: TypeError: Cannot read property 'then' of undefined Can I put the promise…
KVNA
  • 847
  • 1
  • 11
  • 24
4
votes
3 answers

Returned unirest response in node.js is undefined

I am working on facebook bot, but I am in no way a node.js developer, this being my first time in using it, because I wanted to get out of my comfort zone for a little bit. This is my request function function requestExc() { var resDictionary =…
trusk
  • 1,634
  • 2
  • 18
  • 32
4
votes
2 answers

How to avoid sending Cookie header in java unirest requests?

I noticed that using unirest java library cookies are by default sent in requests after being set in responses (just like any browser does). Is there any way to avoid it? Example: public class Main { private static HttpResponse
Zac
  • 2,180
  • 2
  • 23
  • 36
4
votes
1 answer

Calling Method at the End of Program Execution

I am creating a client library for an API endpoint using Unirest to simulate GET and POST requests. Once the program finishes, the following code must be called in order to terminate the current thread. Unirest.shutdown(); // must be called in order…
Malik Brahimi
  • 16,341
  • 7
  • 39
  • 70
4
votes
1 answer

Server Log in java using Unirest

I use unirest for call method from API. But after implement it in my code and see in server log, it always call closing expired connections. This my code: public static JSONArray getJsonArray(String url, Map filter){ GetRequest…
Faisal Silitonga
  • 423
  • 1
  • 7
  • 14
4
votes
1 answer

How to wait for all async REST calls are finished using Unirest?

Being new to async programming i am wondering how i van wait for all futures to complete? In my current use case i have to read a file and post the content line by line using JSON post to a REST Webservice. But when i do this in the normal way the…
Marco
  • 15,101
  • 33
  • 107
  • 174
4
votes
1 answer

Problems using unirest in Android Studio

I have been getting some errors in my logcat that crash my application while trying to execute some unirest requests. I know you have to generate a special unirest jar with all the dependencies but I have had problems with maven and did not do this,…
ChonBonStudios
  • 213
  • 4
  • 14
4
votes
1 answer

How to map JSON response to custom class object

I am calling an API in C# using unirest.io. I get following JSON response (as response.Body). { "persons": [{ "id": "a010", "name": "Joe", "subjects": [ "Math", "English" ] }, { …
theGeekster
  • 6,081
  • 12
  • 35
  • 47
3
votes
1 answer

How to receive the response body as an InputStream in Unirest?

Consider the following example: import java.io.InputStream; import kong.unirest.GetRequest; import kong.unirest.HttpResponse; class Download { private long byteCounter; private long contentLength; InputStream download(GetRequest…
soc
  • 27,983
  • 20
  • 111
  • 215
3
votes
0 answers

Get UnirestConfigException when using Unirest API in Java

Getting Unirest Config exception when I use java with Unirest API to call the web service asynchronous way. It is working as expected in the sync method. I am writing a Java code for Apache Spark to call REST API. Future> future =…
user3438332
  • 99
  • 3
  • 11
3
votes
0 answers

Problem with the Android unirest library - static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier

I'm using the mashape unirest lirary to make POST HTTP calls in android, but when I tried to get the response I'm getting the issue No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier I think the issue is with the…
Kiran Suvarna
  • 271
  • 6
  • 21
1
2
3
23 24