I have JSESSIONID that i get from JasperReports Server RestAPI POST call. How can i use this sessionID for the future Report Service API calls? I am using REST API. Can any one give me a sample or any source code or any solution for this. I dont want to create LDAP/CAS for singllr-signon business. Please help me to trouble shoot this in Java.
Steps that i followed:
1. created session using JasperReports Server POST rest api call
2. tried to use that sessionID in the future /report service.
Add new header "cookie", and set value = JSESSIONID, send your further request with the header.
Related
UPDATE 2
SOLVED, I was missing Header String tutorial instructions at https://developer.twitter.com/en/docs/basics/authentication/guides/authorizing-a-request.html
Answer to my question: Headers must not contain any json data.
Here's my fully functional project, just insert your credentials and you are ready to send Twitter direct messages:
https://github.com/ricarrrdo/gs-rest-service
Note: I'm using Spring deprecated AsyncRestTemplate, so if someone knows how to use the new WebClient, please upgrade restASyncClientBody() method inside Application.java - it would be much appreciated!
UPDATE 1
https://github.com/ricarrrdo/gs-rest-service/blob/master/src/main/java/hello/Application.java#L2-L12
This link above is my spring boot project which recreates Twitter given example at https://developer.twitter.com/en/docs/basics/authentication/guides/creating-a-signature.html to authenticate and authorize a API request.
It's working fine, just compile/run with mvn spring-boot:run and watch console output.
You can check lines 41-52, which are the same parameters used in Twitter example.
Problem/Question
I'm trying to send a Direct Message on Twitter via Twitter API but I keep getting Bad Authentication data error. How should I change my code to be able to send direct messages?
I mean: In https://developer.twitter.com/en/docs/basics/authentication/guides/creating-a-signature.html there's an example with how to create a valid Oauth header using x-www-form-urlencoded parameters. But how can I create valid Oauth headers when sending Json?
Twitter tutorial for direct messages here -
https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event
Notes
Authorization header needed to send a direct message:
authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY",
oauth_nonce="AUTO_GENERATED_NONCE",
oauth_signature="AUTO_GENERATED_SIGNATURE",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
oauth_token="USERS_ACCESS_TOKEN", oauth_version="1.0"
As part of current caching system, we are trying to fetch twitter share count for our site url using "https://cdn.api.twitter.com/1/urls/count.json?url=" . We call this API from Spring Java Rest Controller. This Api works fine for few attempts for the same url. But many time this is throwing timeout exception even after retrial.
We tried to run curl command on above API for same url from APP server and we see the same behavior. Do we know, why it is happening. Does twitter blocks server Ip address if many requests comes from same server. Is it the right API to get count for a url or do we need to use different API.
Any help in this regard will be great.
Thanks
Amit
I just found one solution to do that.
API URL : https://api.twitter.com/1.1/search/tweets.json?q=www.myABCwebsite.com
Look for the following field under "statuses" object.
"statuses_count": 6400,
Am using eclipse generated client classes(JAX bean class)..Any one please tell me how can set the request time out for a soap web service client?..
I have refered following links..
how to set request time out of web service client(java)
http://blogs.adobe.com/rohit/2013/04/30/configurable-request-timeout-for-client-side-soap-calls/
But i could not find a solution for this..
Thanks
Why can't I make a get request from the back end to google's Query Suggestion Service using Java?
I want to make a get request to this service Google: Query Suggestion Service /suggest Protocol.
so that I can get a response which would list suggested queries. It seems like this library is only for front end javascript applications though because there is a paramater 'client' which needs to be provided. If I set it to chrome and make the request via chrome it works fine. But if I try and make the request using the default in java I don't get anything back.
If this is not possible is there any other tool that does a similar task?
I just had to set my User-Agent to the same as my browser using the setRequestProperty and it worked.
Goal
I am a newbie on Groovy and Drupal 7. My project is to create a node on Drupal 7 via REstfull services using Groovy language. I have setup Rest Server on Drupal 7 and checked with mozilla plugin Poster with sending some authentication and creation Post requests. It works perfectly fine.
Problem
However problem comes while establishing same process with Groovy/Java. I used HttpBuilder that basically works on top of Apache HttpClient.
In order to authenticate I need to send username/password to a /user/login URI. Next time I need to do something, such as a POST request ( e.g. create a Drupal node ), I need to use a different URI e.g. /node and somehow pass that auth data (session_name and a session_id that Drupal sends back the first time) with that POST request => that currently does not seem to work:
401 Unauthorized: Access denied for user 42 "trader785876"
I Tried
to copy cookies from the first (auth) request to the second
to extract cookies from the first request, and set them in a header of the second
to extract cookies from the first request, and set them in the POST parameters of the second, etc..
have you tried authenticating using the method here http://groovy.codehaus.org/modules/http-builder/doc/auth.html ?
...
authClient.auth.basic 'myUsername', 'myPassword'
...