Giter Club home page Giter Club logo

domo-java-sdk's Introduction

Java - Domo API SDK

Download License CircleCI Coverage Status

About

  • The Domo API SDK is the simplest way to automate your Domo instance
  • The SDK streamlines the API programming experience, allowing you to significantly reduce your written code
  • This package is published to bintray jcenter

Features:

Setup

The SDK can be added to your project in three ways:

It is currently hosted via bintray and JCenter (It will be in Maven central eventually):

repositories {
    maven {
        url  "http://dl.bintray.com/domoinc/domo-java-sdk"
    }
}

Maven:

<dependency>
  <groupId>com.domo</groupId>
  <artifactId>domo-java-sdk-all</artifactId>
  <version>0.4.3</version>
</dependency>

Gradle:

compile 'com.domo:domo-java-sdk-all:0.4.3'

Classic Jar Import:

  • Clone this repository
  • Using a Bash Terminal, navigate to the cloned repository folder
  • Create the Jar files via the Bash command ./gradlew publishToMavenLocal
  • The Jars will be located in domo-java-sdk-all/build/libs/
  • Copy the Jars to your project folder, and add them to your build path

Usage

  • See the Client Test File for full usage and examples.
  • Create an API Client on the Domo Developer Portal
  • Use your API Client id/secret to instantiate a DomoClient()
  • Multiple API Clients can be used by instantiating multiple Domo Clients
  • Authentication with the Domo API is handled automatically by the SDK
  • If you encounter a 'Not Allowed' error, this is a permissions issue. Please speak with your Domo Administrator.
public class Example {

    public void domoSDKUsage() {

        //Build an SDK configuration
        Config config = Config.with()
                .clientId("MY_CLIENT_ID")
                .clientSecret("MY_CLIENT_SECRET")
                .apiHost("api.domo.com")
                .useHttps(true)
                .scope(USER, DATA)
                .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
                .build();

        //Create an instance of the SDK Client
        DomoClient domo = DomoClient.create(config);

        //Manage DataSets
        DataSetClient datasets = domo.dataSetClient();
        datasets.create();

        //Manage Streams
        StreamClient streams = domo.streamClient();
        streams.create();

        //Manage Users
        UserClient users = domo.userClient();
        users.create();

        //Manage User Groups
        GroupClient groups = domo.groupClient();
        groups.create();
    }
}
Snapshots

You can use snapshot versions through JitPack:

  • Go to JitPack project page
  • Select Commits section and click Get it on commit you want to use (top one - the most recent)
  • Follow displayed instruction: add repository and change dependency (NOTE: due to JitPack convention artifact group will be different)

java lib generator

domo-java-sdk's People

Contributors

brandontysonmoss avatar bryan-jamf avatar checketts avatar gurfuzle avatar jasonleehodges avatar murphysean avatar rswingler avatar ryanmurf avatar thattolleyguy avatar westse 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

Watchers

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

domo-java-sdk's Issues

Feature Request: Add ability to create streams on existing data sets.

We recently had to create new credentials for a custom application since the past client credentials expired due to the user no longer being active in domo. The new credentials do not have a stream available for the dataset, it appears that there is no current way to create a stream on an existing dataset. This requires us to export and subsequently import the large dataset to begin publishing data to domo.

API did not work since 28 Nov 2018

Hi.
My codes for exporting dataset as csv file were performing correctly until since 28 Nov 2018.
But now it is in trouble with the follow error message:


Exception in thread "main" com.domo.sdk.request.RequestException: Error making request url:https://api.domo.com/v1/datasets/b56ef383-cbb4-4b94-bb14-06c89b0b193c/data?includeHeader=true responseBody:<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 406 Not Acceptable</title>
</head>
<body><h2>HTTP ERROR 406</h2>
<p>Problem accessing /error. Reason:
<pre>    Not Acceptable</pre></p><h3>Caused by:</h3><pre>com.domo.bedrock.service.exception.UnauthorizedException: Full authentication is required to access this resource
	at com.domo.gateway.config.security.OAuthAuthenticationProvider.values(OAuthAuthenticationProvider.java:39)
	at com.domo.gateway.config.security.OAuthAuthenticationProvider.getCustomer(OAuthAuthenticationProvider.java:48)
	at com.domo.gateway.config.security.OAuthLoggingRequestFilter.doFilterInternal(OAuthLoggingRequestFilter.java:50)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at com.domo.bedrock.maestro.web.ServiceLogFilter.doFilterInternal(ServiceLogFilter.java:158)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at com.domo.gateway.config.security.HttpRedirectionDetectionFilter.doFilterInternal(HttpRedirectionDetectionFilter.java:61)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.Server.handle(Server.java:499)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:748)
</pre>
<hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>

	at com.domo.sdk.request.Transport.getCsv(Transport.java:110)
	at com.domo.sdk.datasets.DataSetClient.exportData(DataSetClient.java:151)
	at ExportDataExample.dataSetClient_smokeTest(ExportDataExample.java:96)
	at test.main(test.java:17)

Since I did not do any change to the code, I suppose there may be some changes in the api.
Do you have any suggetions?

Thank you.

Exporting datasets doesn't work when it is the first call by the SDK

If you create a client and immediately try to export data, the call fails with a 406 error. This is due to the first call trying to make the oauth token, but keeping the export text/csv call.

As a work around, call get the dataset first then call the export:

dsClient.get(dataSetId)
dsClient.exportDataToFile(dataSetId,true, f);

I'll release a fix for this shortly.

SDK isn't in Maven

The SDK is open source and will be in Maven shortly.

Follow this issue to be notified when that work has been completed.

Cannot export DataSet

I want to export the dataset, such as
https://api.domo.com/v1/datasets/317970a1-6a6e-4f70-8e09-44cf5f34cf44/data?includeHeader=true&fileName=data-dump.csv
to a .csv file and using the dataSetId as follows:

    String dataSetId = "317970a1-6a6e-4f70-8e09-44cf5f34cf44";
    File f = File.createTempFile("sample-export", ".csv");
    dsClient.exportDataToFile(dataSetId, true, f);
    System.out.println("Wrote out file:"+f.getAbsolutePath());

by referencing the ExportDataExample.java:

But I still cannot export correct .csv file with data I want.
I was afraid that I did not use the API in a right way since the link to Client Test File is broken.
I wonder how I can export the dataset correctly by using Java.

Thank you very much.

Client Test File

Use Proxy to connect DOMO API

Hello,

I am using DOMO SDK version 0.2.0 with Maven.

I tried to specify proxy host and port, but couldn't find any good modification point.
It would be nicer if we could specify proxy host and port like this:

        //Build an SDK configuration
        Config config = Config.with()
                .clientId("MY_CLIENT_ID")
                .clientSecret("MY_CLIENT_SECRET")
                .apiHost("api.domo.com")
                .useHttps(true)
                .proxyHost("myproxyhost")
                .proxyPort(myproxyport)
                .scope(USER, DATA)
                .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
                .build();

Is proxy usage supported in DOMO SDK?
Is there any good implementation way to specify proxy settings?

Thanks,

Developers need 'sandbox' api access

I am now using the SDK in work, but would like to use in private as well.
But I have no Domo account, so I cannot access Domo API.
I tried to sign up free account a few days ago, but response is nothing...

Should I do what to join developement the SDK and get client Id and client secret?

Cannot convert access token to JSON

We have recently started getting the following error intermittently while trying to list the datasets.

Caused by: com.domo.sdk.request.RequestException: Error making request url:https://api.domo.com/v1/datasets?limit=49&offset=0 reponseBody:{\"error\":\"invalid_token\",\"error_description\":\"Cannot convert access token to JSON\"}\n\tat com.domo.sdk.request.Transport.getJson(Transport.java:40)\n\tat com.domo.sdk.datasets.DataSetClient.list(DataSetClient.java:81)
Any suggestions?

We use com.domo.sdk.datasets.DataSetClient.list to get hold of the dataset Id, given a dataset name. Is there a better way to resolve a dataset name to id? Thanks!

"bootRepackage" Not Found

I am trying to get the external jars to add to my Domo project. I cloned the respository, but I get this error when I run the command "./gradlew bootRepackage".

err

Any reason as to what could be the cause of this? Thanks!

Full authentication is required to access this resource

I am trying to use the Java SDK to access a stream, when I run the app I get the following error

Exception in thread "main" com.domo.sdk.request.RequestException: Error making request url:https://api.domo.com/v1/streams/662?fields=all reponseBody:{"status":401,"statusReason":"Internal Server Error","path":"/v1/streams/662","message":"com.domo.bedrock.service.exception.UnauthorizedException: Full authentication is required to access this resource","toe":"O6Q67O9N7H-U3ALR-NVA7L"}

Connection leak issue

Getting the following warning log repeatedly:

WARNING: A connection to https://api.domo.com/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);```

Publish package to Maven central repository

"Based on the current timeline, builds that use JCenter will be able to resolve dependencies until February 1, 2022 without changes. After that date, there are no guarantees that you will be able to build your software if you continue to use JCenter." from https://blog.gradle.org/jcenter-shutdown

The recommendation is to publish these packages to maven central.

Some helpful documentation for doing so:
https://blog.sonatype.com/dear-bintray-and-jcenter-users-heres-what-you-need-to-know-about-the-central-repository

Failed to read artifact descriptor for com.domo:domo-java-sdk-all:jar:0.4.0

When I defined it in maven with API version 0.4.0, it failed to load.
I think it is because bintray-domo is disabled.
Is there any alternative repository?
Is there any plan to publish it to maven central in the future?

Failed to read artifact descriptor for com.domo:domo-java-sdk-all:jar:0.4.0: 
Could not transfer artifact com.domo:domo-java-sdk-all:pom:0.4.0 from/to bintray-domo (https://dl.bintray.com/domoinc/domo-java-sdk):
Authorization failed for https://dl.bintray.com/domoinc/domo-java-sdk/com/domo/domo-java-sdk-all/0.4.0/domo-java-sdk-all-0.4.0.pom 403 Forbidden

Invalid token

Hi All,

I've started using the domo java SDK and I put the right client ID and clientSecret.
whan I try to run tests:

I have this as a LOG:
750 [main] INFO com.domo.request.Slf4jLoggingInterceptor - Authorization: Bearer starterTokenTheIsInvalid

and this as an Error:
reponseBody:{"error":"invalid_token","error_description":"Cannot convert access token to JSON"}

Any idea how to fix this please?

Thanks

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.