When i am trying to fetch the comments the i am getting this error message.
article_url = "http://de.richarddawkins.net/articles/atheist-stephen-hawking-negiert-existenz-eines-gottes-die-wissenschaft-biete-eine-uberzeugendere-erklarung-des-universums"
HTTParty.get("https://graph.facebook.com/comments?id=#{article_url}")
#<HTTParty::Response:0xb4fa49c parsed_response={"error"=>{"message"=>"An access token is required to request this resource.", "type"=>"OAuthException", "code"=>104, "fbtrace_id"=>"Asfda7D+/qM"}}, #response=#<Net::HTTPBadRequest 400 Bad Request readbody=true>, #headers={"www-authenticate"=>["OAuth \"Facebook Platform\" \"invalid_token\" \"An access token is required to request this resource.\""], "access-control-allow-origin"=>["*"], "pragma"=>["no-cache"], "cache-control"=>["no-store"], "facebook-api-version"=>["v2.2"], "expires"=>["Sat, 01 Jan 2000 00:00:00 GMT"], "content-type"=>["application/json; charset=UTF-8"], "x-fb-trace-id"=>["Asfda7D+/qM"], "x-fb-rev"=>["2778708"], "vary"=>["Accept-Encoding"], "x-fb-debug"=>["pSZo8HXiIaM0tu9f0ss+swqnhShjgCQYpm3GN8GQS+olRNjmwTfiHPPE/8xZJRxu787j7JlwCHW9kwuayjcgeA=="], "date"=>["Mon, 16 Jan 2017 06:23:43 GMT"], "connection"=>["close"], "content-length"=>["139"]}>
Please help me to solve this problem.
I think you need to just add ACCESS_TOKEN into your query string.
Ex.
HTTParty.get("https://graph.facebook.com/comments?id=#{article_url}&access_token=#{ACCESS_TOKEN}")
Hope it's work
Related
I'm trying to select a record from particular view in Airtable using the Java library
So far i have set break points to check if everything is initialised and it seems be okay. My api key is correct and the Airtable instance is setup correctly.
Airtable airtable = new Airtable().configure(AIRTABLE_API_KEY);
Base basebase = airtable.base("my-airtable-base");
This is my error:
Nov 12, 2020 5:53:08 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: brw=brwkel6HWNoWVEl49; path=/; expires=Fri, 12 Nov 2021 17:53:08 GMT; domain=.airtable.com; samesite=none; secure; httponly". Invalid 'expires' attribute: Fri, 12 Nov 2021 17:53:08 GMT
Exception in thread "main" com.sybit.airtable.exception.AirtableException: {"error":"NOT_FOUND"} (UNDEFINED_ERROR) [Http code 404]
at com.sybit.airtable.exception.HttpResponseExceptionHandler.onResponse(HttpResponseExceptionHandler.java:29)
at com.sybit.airtable.Table.select(Table.java:206)
at com.sybit.airtable.Table.select(Table.java:327)
at com.hived.AirtableInstance.selectTableView(AirtableInstance.java:43)
at com.hived.Main.main(Main.java:25)
This is the function that is causing the error:
public void selectTableView() throws AirtableException, HttpResponseException {
List<Bus> stops = base.table("Bus").select("Stops");
}
I was expecting it to pass all stops from the bus table into the stops list.
I'm not sure what I'm doing wrong, so any help would be much appreciated.
Turns out you need to do a few things.
Add log4j to your project
Add slf4j-simple to your project
Once those dependencies are added. You should now see there is no warning anymore.
Now to remove the error. It turns out instead of referencing the base name, you need to call the base id instead.
base = airtable.base("applJilugnJCtDRdh");
Thats it! Hope this helps anyone else.
I am working on a tool which uses ews-java-api to create, update and delete calendar items in Outlook agenda. It has been working fine, but now sometimes when it tries to update some calendar item, I get following error:
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:879)
at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:796)
at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:286)
at java.lang.Thread.run(Thread.java:745)
Recently all the exchange accounts have been migrated from local Outlook servers to Office365 cloud servers. Maybe this has something to do with it? Or anybody have any idea on what is going wrong?
Following code is to perform the update for an item:
Item it = alitems.get(i);
...
it.update(ConflictResolutionMode.AlwaysOverwrite);
Following is the url being used to access office365 ews:
exchangewebservice = https://outlook.office365.com/EWS/Exchange.asmx
Thanks in advance
Edit: I use ews-java-api version 2.0
Edit: Here you can see that the error occurs on one line and than the next line, with the same recipient it doesn't occur...
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:880)
at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:703)
at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:283)
at java.lang.Thread.run(Thread.java:745)
WARN be.vrt.quintiqexchange.main.QuintiqAdapter - At least one recipient isn't valid., A message can't be sent because it contains no recipients.by UPDATE for subject: on Thu Jun 23 14:00:00 CEST 2016 Thu Jun 23 19:00:00 CEST 2016 of user name.lastname#domain.com
INFO be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: NIET DAG on Fri Aug 05 10:00:00 CEST 2016 Fri Aug 05 18:00:00 CEST 2016 of user name.lastname#domain.com
INFO be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: PROEF st5 on Mon Aug 22 10:00:00 CEST 2016 Mon Aug 22 20:30:00 CEST 2016 of user name.lastname#domain.com
This means that the recipient isn't really the issue, I guess...
p.s. I replaced the original mailaddress but believe me, it's a correct mailadres :)
In my case, if the address is not properly trimmed and has any whitespace characters at all, EWS vomits this exception up.
I'm building a web service in java, deploying it under Jboss-as-7.1.1.Final, based on org.apache.cxf.
I need to expose a web method that takes in input a date field that can reach many centuries in the past.
At the moment I'm using java.util.Date.
So, my web method is
public UpdatePersonResponse updatePerson(UpdatePersonRequest request) {
...
}
the request bean UpdatePersonRequest has:
...
private Date birthday;
...
In the soap request that I'm testing I put:
<!--Optional:-->
<birthday>1452-04-15</birthday>
The apache cxf logs show:
16:07:36,568 INFO [org.apache.cxf.interceptor.LoggingInInterceptor] ... Inbound Message
[...]
<birthday>1452-04-15</birthday>
(this is correct)
A custom log I added into the set method of the request bean shows:
16:07:36,843 DEBUG com.xxx.xxx.service.request.UpdatePersonRequest ... called setBirthday with argument [06/04/52 0.00]
(this is wrong)
Then the request bean is valorized as follows:
UpdatePersonRequest [... birthday=Thu Apr 06 00:00:00 CET 1452, ...]
(this is wrong)
So I obtain 1452 April 06, and not 1452 April 15.
I tried with different dates, for example,
soap:
<birthday>1452-04-30</birthday>
custom log:
21:11:51,607 DEBUG [com.xxx.xxx.service.request.UpdatePersonRequest] ... called setBirthday with argument [21/04/52 0.00]
(wrong)
The bean is:
UpdatePersonRequest [... birthday=Fri Apr 21 00:00:00 CET 1452 ...]
(again wrong)
I obtain April 21 and not April 30.
I tried with several dates and noticed that the issue occurs for dates prior then 15 Oct 1582. For more recent dates all works fine and the request bean is correctly valorized.
Is there some java.util.Date limitation that I'm not considering?
Should I use another java Type to represent these kind of dates, and what?
Thank you very much.
EDIT
The effect is that the date I entered into the soap request is converted in Julian date and then the Date I persist on the database will be this converted date.
But I'd like to write on DB the exact date I enter in the request and not a corrected one, in other words I want the caller to deal with the right date system to use, and not any conversion be made automatically by the system.
How can I obtain this?
You are encountering the switch from the Julian to the Gregorian calendar. This is a historical event, not a feature of Java. Googling "Gregorian calendar" will tell you more.
Is there some way to get modified date of this file?
I want to check the data every day and download it only if has changed, I tried with HttpURLConnection and con.getHeaderFields() but no results:
{null=[HTTP/1.1 200 OK], Access-Control-Allow-Origin=[*], Age=[158], Cache-Control=[max-age=7200], Connection=[close], Content-Length=[235409], Content-Type=[text/plain], Date=[Wed, 19 Dec 2012 10:00:52 GMT], Expires=[Wed, 19 Dec 2012 11:58:13 GMT], Server=[Apache/2], X-Android-Received-Millis=[1355911252001], X-Android-Sent-Millis=[1355911251975]}
Is there a better way of getting an md5 hash and compare it with a local file?
Nope, there is no general way to get the modified date of a URL. Computing the MD5 hash of the HTTP response body and comparing that against the local file is the best way.
I'm trying to use javamail to download a mailbox of 1000 messages of hotmail.
The problem is after an hour or so, I get a Pop Session timeout exception, and I can't fetch messages anymore.
C: TOP 3210 0
S: +OK 1444 byte(s)
X-Message-Delivery: Vj0zLjQuMDt1cz0wO2k9MDtsPTA7YT0x
X-Message-Status: n:0
X-SID-PRA: Super Wall <apps+ocdlfcez#facebookmail.com>
X-SID-Result: Pass
X-Message-Info: R00BdL5giqoqgO8FeGWl8Lch6n3is6BT1wNitKPj0Jb+fghk1p9MsC+MFGyB2nflerotq/xZ5r8LiguM+3GjEOSj3umkoXeU
Received: from mx-out.facebook.com ([204.15.20.140]) by bay0-mc7-f15.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668);
Tue, 8 Apr 2008 15:14:55 -0700
Received: from api.facebook.com (intlb01-mip1.sctm.tfbnw.net [10.1.240.6])
by mx-out.facebook.com [email018.sctm.facebook.com] (8.13.6/8.13.6) with ESMTP id m38MEtOg030239
for <xgameprogrammer#hotmail.com>; Tue, 8 Apr 2008 15:14:55 -0700
X-Facebook: from zuckmail ([168.143.164.188])
by api.facebook.com with HTTP (ZuckMail);
Date: Tue, 8 Apr 2008 15:14:55 -0700
To: Ahmed Saleh <xgameprogrammer#hotmail.com>
From: Super Wall <apps+ocdlfcez#facebookmail.com>
Reply-to: Facebook <apps+ocdlfcez#facebookmail.com>
Subject: You just received a new photo from Lejla Boric
Message-ID: <03df95f3306af0a88432e7fcca22f7ac#api.facebook.com>
X-Priority: 3
X-Mailer: ZuckMail [version 1.00]
X-Facebook-Notify: platform_email
Errors-To: apps+ocdlfcez#facebookmail.com
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_03df95f3306af0a88432e7fcca22f7ac"
Return-Path: apps+ocdlfcez#facebookmail.com
X-OriginalArrivalTime: 08 Apr 2008 22:14:55.0926 (UTC) FILETIME=[F9D6A560:01C899C5]
.
C: RETR 3210
S: -ERR POP3 session timed out
javax.mail.MessagingException: No inputstream from datasource;
SentDate : Wed Apr 09 01:14:55 AST 2008
nested exception is:
As I said in my comment, this is just a simple case of the session timing out. Like anything, the mail server will have a time limit to prevent excessive access, which is how would describe downloading emails for over an hour!
There is nothing wrong with your code, your just asking too much of hotmail / the mail server!
Though, just some friendly advice: the next time you ask a question here on SO, please don't post irrelevant information like you have done here. In cases like yours, it is helpful to see atleast a snippet of the code that is responsible for that part of the application that is functioning incorrectly and any exceptions - we'd also need to see the line(s) of code mentioned in the stack trace... However, a start would be to actually ask a question instead of this stating a fact, like you have done here!