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.
Related
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
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 downloading a JAR file, and would like to utilize If-Modified-Since so I don't get the whole file if I don't need it, but for some reason my vanilla Apache (afaik) isn't returning the 304 correctly.
This is from wireshark:
GET /whatever.jar HTTP/1.1
If-Modified-Since: Sat, 04 Jan 2014 21:46:26 GMT
User-Agent: Jakarta Commons-HttpClient/3.1
Host: example.com
HTTP/1.1 200 OK
Date: Sat, 04 Jan 2014 20:32:31 GMT
Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8e DAV/2 mod_jk/1.2.26 PHP/5.3.6 SVN/1.4.4
Last-Modified: Sat, 04 Jan 2014 19:13:14 GMT
ETag: "b6c037-1ddad9f-d17a6680"
Accept-Ranges: bytes
Content-Length: 31305119
Vary: User-Agent
Content-Type: text/plain
... [bunch of bytes] ...
There aren't other headers I need to specify, is there? Am I missing a module that Apache needs in order to read this header correctly?
Any other thoughts or suggestions?
Here is my Java code, for reference:
File jarFile = new File(filePath);
GetMethod get = new GetMethod(downloadUrl);
Date lastModified = new Date(jarFile.lastModified());
get.setRequestHeader("If-Modified-Since", DateUtil.formatDate(lastModified));
HttpClient client = new HttpClient();
int code = client.executeMethod(get);
UPDATE: Solution
The If-Modified-Date needed to exactly match the server, and I achieved this by explicitly setting the lastModifiedDate on the downloaded file:
String serverModified = get.getResponseHeader("Last-Modified").getValue();
jarFile.setLastModified(DateUtil.parseDate(serverModified).getTime());
After doing this, subsequent calls would not download the file.
In order to use the "If-Modified-Since" header, you must send an identical header value as the "Last-Modified" header, that is Sat, 04 Jan 2014 19:13:14 GMT != Sat, 04 Jan 2014 21:46:26 GMT. Apache cannot guarantee the file wasn't modified and given a past time on purpose (perhaps through a version control roll-back).
If you want, you may check the "Last-Modified" header on the client side, by using a HeadMethod first to avoid "getting" the resource if it hasn't been modified. Then you would use a "GetMethod" if it has been modified.
See RFC2616 - Section 9, "HTTP/1.1: Method Definitions" for 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!