Coder Social home page Coder Social logo

fullcontact4j's Introduction

FullContact4j [Deprecated]

This is no longer supported. Please use our updated java client. Also checkout our client libraries here.

A Java client for the FullContact API. Supports Java 7+.

For FullContact4j 2.0 and later, we've designed the client from the bottom up with tons of cool new stuff.

See the changelog here.

Coming from version 1? Read this wiki page for a rundown of the big changes, then continue here.

Add to your project

FullContact uses Bintray as a repository.

Maven

<repositories>
  <repository>
    <id>fullcontact</id>
    <url>http://dl.bintray.com/content/fullcontact/fullcontact-oss</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.fullcontact</groupId>
    <artifactId>fullcontact4j</artifactId>
    <version>(version here)</version>
  </dependency>
</dependencies>

Gradle

repositories {
    maven {
        url "http://dl.bintray.com/content/fullcontact/fullcontact-oss"
    }
}

dependencies {
    compile group: "com.fullcontact", name: "fullcontact4j", version: "(version here)"
}

Dependencies

OkHttp, which FullContact uses as an HTTP client.

Retrofit, for interacting with the FullContact API.

Jackson, a JSON library, for conversion of API responses.

Working with FullContact4j

FullContact4j 2.0 is designed from the ground up to be as painless to use as possible. FullContact clients are customizable and require just one line of code to set up; requests take only one line to create and one to execute. FullContact4j abstracts away all the headaches associated with HTTP communication with the API, ranging from managing possible response scenarios to keeping your requests below your account's rate limit (queries per second). Make a request object, execute it, and get a response object back.

Quick Overview

Firstly, read the API documentation! FullContact4j provides an object layer to FullContact API communication, but understanding webhooks, response flows, request parameters, and common snags is still important.

Once you’re on board with the API behavior, using FullContact4j is easy. Look up social and demographic data for an email address in just 3 lines of code:

FullContact fullContact = FullContact.withApiKey("your-api-key").build();
PersonRequest personRequest = fullContact.buildPersonRequest().email("[email protected]").build();
PersonResponse personResponse = fullContact.sendRequest(personRequest);

(Don't have an API key? You can pick one up for free right here.)

withApiKey returns a FullContact client builder. You can specify timeouts, your own OkHttpClient, a user agent, and much more.

Behind the scenes, FullContact4j has done a lot for you:

  • authenticated with FullContact
  • accounted for rate limiting (for person API requests), sending the request if you are below your rate limit (or waiting to send your request until the time is right if you have exceeded your account limit).
  • checked for errors and parsed useful messages/data
  • turned the response JSON into a perfectly normal Java object.

If you prefer asynchronous calls, that requires only one change:

fullContact.sendRequest(personRequest, new FCCallback() {
  public void success(PersonResponse response) {
    System.out.println("got a response back!");
  }

  public void failure(FullContactException exception) {
    System.out.println("got an error :( ");
  }
});

You can see a simple demo of this client in action in the Hello World app example!

Making Requests

First, let’s get our request builder.

fullContact.buildPersonRequest()

All API requests can be made by calling their corresponding build____Request() method. Then, add relevant parameters and build:

fullContact.buildPersonRequest().email(“bart@fullcontact.com”).build();

It’s generally good practice to specify webhooks in your request, in case of a 202 response from Person API or a Card Reader upload for instance. That’s all configurable as well:

fullContact.buildPersonRequest()
  .webhookUrl(“http://www.example-site.com/api/finishedlookup”)
  .webhookBody(true)
  .email(“bart@fullcontact.com”)
  .build();

If the webhook URL is specified, all Person API responses will by default return a 202 response code (see webhooks documentation for more detail). If you need to test webhooks before implementing them in your own technology, you can always use something like requestb.in.

If you clearly mis-configured your request (adding two search parameters to Person API, or not giving a name to the name deducer API, etc), build() will throw an IllegalArgumentException with a message about what you did wrong:

java.lang.IllegalArgumentException: Request must specify exactly one: email or username
  at com.fullcontact.api.libs.fullcontact4j.http.name.NameDeduceRequest$Builder.validate(NameDeduceRequest.java:51)
  …

Now let’s send our request. Since FullContact4j uses a thread pool to execute requests, multiple consumers should be fine to make thread-safe requests from the same client instance. This can be done synchronously or asynchronously.

Synchronously is a little easier:

PersonRequest request = fullContact.buildPersonRequest().email(“bart@fullcontact.com”).build();
PersonResponse response = fullContact.sendRequest(request);

Every request has a corresponding response that it will return when sendRequest is called. This object contains all response data back from FullContact.

Asynchronous requests are similar. sendRequest() just takes one more parameter -- a FCCallback. It has a generic type parameter of the response type (PersonRequest corresponds to PersonResponse, LocationNormalizationRequest to LocationNormalizationResponse, etc). success() is called when a useful response is returned from the APIs:

fullContact.sendRequest(locationEnrichmentRequest, new FCCallback() {
  public void success(LocationEnrichmentResponse response) {
    System.out.println("got a response back!");
  }

  public void failure(FullContactException exception) {
    System.out.println("got an error :( ");
  }
});

You can turn webhook responses into these response objects using fromJson:

public void onCardReaderWebhook(String body) {
  CardReaderFullResponse response = CardReaderFullResponse.fromJson(body);
  System.out.println("Just got a card reader transcribed for " + response.getContact().getName().toString());
}

public void onPersonWebhook(String body) {
  PersonResponse response = WebhookResponse.fromJson(body, PersonResponse.class);
  System.out.println("Just got social profile info for " + response.getContactInfo().getName().toString());
}

As long as a response returns 200 or 202, FullContact4j will turn it into a java object representation holding all the information the regular JSON response would. If it's not in the JSON, it'll be an empty field.

PersonResponse response = client.sendRequest(personRequest);
if(response.getStatus() == 200) { //202 (searching) is possible here, we'll get an empty response!
  for(SocialProfile profile : response.getSocialProfiles()) {
    System.out.println("Check out my " + profile.getTypeId() + " profile: " + profile.getUrl());
  }
}

LocationEnrichmentResponse location = client.sendRequest(locationRequest);
System.out.println("I found a new place in " + location.getContinent() + " with a population of " + location.getPopulation());

When you're done with the client, be sure to call shutDown() on it to clean up any unused state in the client.

Error Handling

If an error is encountered (these correspond to yellow/red non-2xx response codes on the API flow diagrams), a FullContactException is created with useful information about the error, including errorCode and a message from the FullContact APIs about the nature of the error. For synchronous requests, this will cause sendRequest() to throw FullContactException. In asynchronous requests, FCCallback.failure(FullContactException exception) is called instead.

Supported APIs

FullContact4j supports all Person, Company, Email, Name, Location, Card Reader, and Account Statistics endpoints. These can all be accessed from their respective build_____Request() methods in the FullContact client. Some will need required parameters (like CardReaderRequest’s requirement for a front image InputStream) and automatically create a builder with those required parameters set.

Advanced

In the background, FullContact4j is making requests using an OkHttpClient. You can supply your own OkHttpClient.

OkHttpClient client = new OkHttpClient();
client.setReadTimeout(3000, TimeUnit.MILLISECONDS);
FullContact fcClient = FullContact.withApiKey("your-api-key").httpClient(client).build();

The user agent and request executor thread count are also configurable. For person API requests, the client will rate limit the amount of requests sent based on the rate limit for your plan. It will hold a request queue and execute at the maximum every 1/ratelimit seconds with some leeway if you haven’t sent requests in a certain period of time. FullContact4j guarantees no Person API rate limiting exceptions only as long a single client instance is the only user of an API key. However, if multiple instances of the client are being used simultaneously, FullContact4J cannot track your usage with high enough accuracy to guarantee that you will never get a rate limit exception (403). These may still occaisionally occur, and should be accounted for in your code. This rate limiter does NOT account for overages or quota limits. Make sure to check your account stats periodically to avoid overages.

I'm on Java 6!

The last Java 6-compatible FullContact4j release was version 3.3.3.

fullcontact4j's People

Contributors

alex-seplowe avatar altsysrq avatar arvindbadlia avatar david-wilson avatar eentzel avatar j-emmel avatar mattdelliott avatar mattsainz avatar mcmancsu avatar parismi avatar prakhar-j avatar salilk avatar skiggz avatar xorlev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fullcontact4j's Issues

Wrapper isn't accounting for rate limits

My script is now using wrapper v2, and I'm getting a lot of: com.fullcontact.api.libs.fullcontact4j.FullContactException: Usage limits for the provided API Key have been exceeded. Please try again later or contact support to increase your limits.

I was under the impression that v2 would be using Guava's RateLimiter to auto throttle the requests to avoid those exceptions... no?

I'm using the default settings (fullContact = FullContact.withApiKey(conf.getString("fullcontact.key")).build();), which means I'm using RateLimiterPolicy.SMOOTH.

Am I missing something?

Cannot use fullcontact4j in Google App Engine standard (java 7) environment

We're running into a problem using the FullContact Card Reader API sdk in Google App Engine.
When trying to use it in the java 7 environment, we're getting the following error calling fullContact.sendRequest. This is happening because we are not using Google's specified ThreadFactory.

com.infusionsoft.cardreaderapi.resource.CardResource requestCardTranscription: Card upload failed (CardResource.java:61)
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:484)
	at java.security.AccessController.checkPermission(AccessController.java:698)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
	at com.google.apphosting.runtime.security.CustomSecurityManager.checkPermission(CustomSecurityManager.java:55)
	at com.google.apphosting.runtime.security.CustomSecurityManager.checkAccess(CustomSecurityManager.java:136)
	at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
	at java.lang.Thread.init(Thread.java:391)
	at java.lang.Thread.init(Thread.java:349)
	at java.lang.Thread.<init>(Thread.java:675)
	at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:572)
	at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:600)
	at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:943)
	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1383)
	at com.fullcontact.api.libs.fullcontact4j.http.RequestExecutorHandler.sendRequestAsync(RequestExecutorHandler.java:82)
	at com.fullcontact.api.libs.fullcontact4j.FullContactHttpInterface.sendRequest(FullContactHttpInterface.java:84)
	at com.fullcontact.api.libs.fullcontact4j.FullContactHttpInterface.sendRequest(FullContactHttpInterface.java:58)
	at com.fullcontact.api.libs.fullcontact4j.FullContact.sendRequest(FullContact.java:148)
	at com.infusionsoft.cardreaderapi.service.FullContactService.uploadCard(FullContactService.java:57)
	at com.infusionsoft.cardreaderapi.service.CardService.requestCardTranscription(CardService.java:52)
	at com.infusionsoft.cardreaderapi.resource.CardResource.requestCardTranscription(CardResource.java:53)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$1.run(Method_.java:169)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.privilegedInvoke(Method_.java:165)
	at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke_(Method_.java:123)
	at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke(Method_.java:42)
	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
	at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:927)
	at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:875)
	at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:829)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.infusionsoft.pancakes.guice.ContentLengthFilter.doFilter(ContentLengthFilter.java:37)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:44)
	at io.buji.pac4j.filter.SecurityFilter$2.adapt(SecurityFilter.java:91)
	at io.buji.pac4j.filter.SecurityFilter$2.adapt(SecurityFilter.java:87)
	at org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:144)
	at io.buji.pac4j.filter.SecurityFilter.doFilter(SecurityFilter.java:87)
	at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:41)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.guice.web.SimpleFilterChain.doFilter(SimpleFilterChain.java:41)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:48)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:37)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
	at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:257)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
	at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:145)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:559)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:519)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:489)
	at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:453)
	at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460)
	at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319)
	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
	at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457)
	at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:238)
	at java.lang.Thread.run(Thread.java:745)```
This could be resolved if we could specify a ThreadFactory. Has anyone else used the sdk in google ap engine successfully?

No Manifest file

How can use this , Because of not any manifest file available?

Can you please release jar file instead of this type of structure sdk.

Usage limits for the provided API Key have been exceeded

Hi,
I have Implemented, a trial version FullContact API in my project. I got the following exception with in my first call itself.
com.fullcontact.api.libs.fullcontact4j.FullContactException: Usage limits for the provided API Key have been exceeded. Please try again later or contact support to increase your limits.
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at com.fullcontact.api.libs.fullcontact4j.http.FCRetrofitCallback.failure(FCRetrofitCallback.java:80)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at retrofit.Utils$SynchronousExecutor.execute(Utils.java:114)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at retrofit.CallbackRunnable.run(CallbackRunnable.java:51)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at java.lang.Thread.run(Thread.java:818)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: Caused by: retrofit.RetrofitError: 403 Forbidden
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
06-19 16:32:22.762 6646-6646/com.example.ebms.myapplication W/System.err: at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)

NeverMind! Old version of FullContact4J

Hello,

I am receiving an error every time I attempt to send a Person Request. I think it might be related to OkHTTP or Retrofit but I'm not sure.

Java 7

com.fullcontact.api.libs.fullcontact4j.FullContactException: Unknown reason for exception, see stack trace
at com.fullcontact.api.libs.fullcontact4j.http.FCRetrofitCallback.failure(FCRetrofitCallback.java:88)
at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
at retrofit.Utils$SynchronousExecutor.execute(Utils.java:114)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at retrofit.Platform$Base$2$1.run(Platform.java:94)
at java.lang.Thread.run(Unknown Source)
Caused by: retrofit.RetrofitError: com.squareup.okhttp.OkHttpClient.open(Ljava/net/URL;)Ljava/net/HttpURLConnection;
at retrofit.RetrofitError.unexpectedError(RetrofitError.java:44)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:395)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
... 4 more
Caused by: java.lang.NoSuchMethodError: com.squareup.okhttp.OkHttpClient.open(Ljava/net/URL;)Ljava/net/HttpURLConnection;
at com.squareup.okhttp.OkUrlFactory.open(OkUrlFactory.java:44)
at com.fullcontact.api.libs.fullcontact4j.http.FCUrlClient.openConnection(FCUrlClient.java:70)
at com.fullcontact.api.libs.fullcontact4j.http.FCUrlClient.execute(FCUrlClient.java:64)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
... 7 more

Can't use the Webhook feature with v2

Hey guys -- when I try to send a PersonRequest along with a webhook pointer, as such:

PersonRequest personRequest = fullContact.buildPersonRequest()
  .webhookId("Some_Webhook_Id")
  .webhookUrl("http://www.google.com")
  .twitterName("BaconSeason")
  .build();

The library throws out this, every time:
Caused by: java.lang.IllegalArgumentException: Request has some webhook parameters set, but no webhook URL.

I verified that params do in fact have FCConstants.PARAM_WEBHOOK_URL set in them. Not sure what's going on exactly...

Broken Link

I found another broken link on the README. It's difficult to learn with so much broken documentation. This one's with the link requestb.in.

Dependency Cleanup

This file contains quite a lot of dependencies: https://github.com/fullcontact/fullcontact4j/blob/master/pom.xml

Retrofit itself is fairly heavy-weight. Many systems already use those libraries with different versions. I've had to exclude all of the transitive dependencies in order to avoid conflicts.

Would you consider either using optional or splitting this package apart in order to give us better control over dependencies.

Using optional scope is the easiest thing to do.

fullcontact4j -> Maven Central.

I know the client jar is published to Bintray, this actually makes it difficult to consume.

Large companies typically hide their build system under layers of abstraction that aren't easy to get changed by developers within it. Typically those companies know about Maven, but not Bintray.

That's certainly the position I've found myself in a number of times at various companies. In order to consume the current jar, I need to download it and go through a bunch of bureaucracy to store it in some special third-party repo within our build system. If it were in Maven Central then it would all "just work".

Please can we get the client jar published to Maven Central. Practically every Java development environment/build-system on that planet knows how to work with that. That's not the case for Bintray.

buildAccountStatsRequest() doesn't work

Hi

I'm using fullcontact4j
In following way:

    FullContact fullContact = FullContact.withApiKey(fullContactKey).build();
    AccountStatsRequest accountStatsRequest = fullContact.buildAccountStatsRequest().setPeriod(2015, 1).build();

where fullContactKey is correct API key

For
AccountStatsResponse accountStatsResponse = fullContact.sendRequest(accountStatsRequest);

I'm getting following error:

com.fullcontact.api.libs.fullcontact4j.FullContactException: Invalid period; YYYY-MM format expected
com.fullcontact.api.libs.fullcontact4j.http.FCRetrofitCallback.failure(FCRetrofitCallback.java:69)
at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
at retrofit.Utils$SynchronousExecutor.execute(Utils.java:114)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at retrofit.Platform$Base$2$1.run(Platform.java:94)

In debbuger i found out that fullcontact4j actually calls https://api.fullcontact.com/v2/stats.json?period=2015-1 without apiKey

It seems that fullContact.buildAccountStatsRequest() doesn't work fine :(

Let me know if i missed something.

Thank you!

Add access to unverified fields of the CardReader API

For the Card Reader API on quality medium, we have no access to the unverified fields, only to the verified values. However, in some cases the info contained there would help. Please add another member to the requestResult containing the unverified informaiton

Update version of okhttp?

Is there any chance you can update to a newer release of okhttp? I've got an unrelated dependency (auth0-java) that depends on a newer version of okhttp.

So I need to either get NoClassDefFoundError because of fullcontact or NoClassDefFoundError because of auth0-java. It seems to me to make more sense to move to the newer version in general.

Or, stop using okhttp because it has always caused issues with classing being renamed and moved across versions and this feels like a never ending nightmare of okhttp class issues. [/rant]

Broken link

The Hello World app example! link on the home page is broken. I'd love to learn from it if you can fix it! Thanks Full Contact.

CardReader Api crash the Application

After executing below line the app get crashed;
FullContact fcClient = FullContact.withApiKey("xxxxxx").httpClient(client).build();

Error Log :
java.lang.NoClassDefFoundError: com.fullcontact.api.libs.fullcontact4j.http.FCUrlClient
at com.fullcontact.api.libs.fullcontact4j.FullContact$Builder.build(FullContact.java:315)
at com.example.ebms.myapplication.Main2Activity$1.onClick(Main2Activity.java:38)
at android.view.View.performClick(View.java:5265)
at android.view.View$PerformClick.run(View.java:21534)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5769)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

Exception on basic company domain lookup

I get an exception with a basic company lookup, though in Postman I can get a response fine for the same apiKey and domain:

Gradle Dependency:
compile group: "com.fullcontact", name: "fullcontact4j", version: "5.4.0"

Code Snippet:
FullContact fullContact = FullContact.withApiKey(apiKey).build();
CompanyRequest companyRequest = fullContact.buildCompanyRequest().domain("westsidebuildingsupply.com").build();
ci = fullContact.sendRequest(companyRequest);

Stack Trace:
com.fullcontact.api.libs.fullcontact4j.FullContactException: Unknown reason for exception, see stack trace

at com.fullcontact.api.libs.fullcontact4j.http.FCRetrofitCallback.failure(FCRetrofitCallback.java:78)
at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
at retrofit.Utils$SynchronousExecutor.execute(Utils.java:114)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Caused by: retrofit.RetrofitError: okhttp3/internal/http/RequestException
at retrofit.RetrofitError.unexpectedError(RetrofitError.java:44)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:395)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
... 3 more
Caused by: java.lang.NoClassDefFoundError: okhttp3/internal/http/RequestException
at okhttp3.internal.huc.HttpsURLConnectionImpl.(HttpsURLConnectionImpl.java:34)
at okhttp3.OkUrlFactory.open(OkUrlFactory.java:73)
at okhttp3.OkUrlFactory.open(OkUrlFactory.java:63)
at com.fullcontact.api.libs.fullcontact4j.http.FCUrlClient.openConnection(FCUrlClient.java:79)
at com.fullcontact.api.libs.fullcontact4j.http.FCUrlClient.execute(FCUrlClient.java:73)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
... 6 more
Caused by: java.lang.ClassNotFoundException: okhttp3.internal.http.RequestException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more

Card Reader - Stream Support

Uploading a card currently takes an InputStream for the frontPhoto. Under the hood, it then copies this into a string before sending it to the server.

It should be possible using Retrofit's multi-part upload support to stream the file through rather than first copying it into a String.

The reason I care about this is because it has the potential to chew up a lot of memory on my server having all of these images in memory.

Organization serialization issue

When I serialized com.fullcontact.api.libs.fullcontact4j.http.person.model.Organization I should get

{"name":"test","startDate":null,"current":true,"endDate":null,"title":null,"isPrimary":true}

And I got this :
{"name":"test","startDate":null,"current":true,"endDate":null,"title":null,"isPrimary":true,"primary":true}

@test
public void testOrganisationSerialization() throws JsonProcessingException {
Organization organization = new Organization("test", null, true, null, null, true);
String actual = new ObjectMapper().writeValueAsString(organization);
assertEquals("{"name":"test","startDate":null,"current":true,"endDate":null,"title":null,"isPrimary":true}", actual);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.