Zdenek Svoboda
posted this on January 05, 2010 00:30
Updated June 17, 2010
Attached you will find Java classes which perform the GoodData data upload. These also show how to perform a full upload (data reload). Please take a look at the boolean fullUpload flag in the GdcRestApiWrapper.integrate. If you want to compile these classes, you need the following (open-source) components on the classpath:
commons-beanutils-1.8.0.jar
commons-logging-1.1.1.jar
ezmorph-1.0.6.jar
commons-collections-3.2.1.jar
log4j-1.2.14.jar
commons-codec-1.3.jar
junit-4.4.jar
commons-lang-2.4.jar
json-lib-2.2.3.jar
commons-httpclient-3.1.jar
Most of these files are part of Apache Commons project, and all of them can be downloaded from here: http://repo1.maven.org/maven2/.
I suggest you to look at class com.gooddata.rest.GdcRestApiWrapperTest, which shows you how easy is to upload a file. There's also some sample CSV file in the same directory as the mentioned class, which you can use to define an ETL interface within a project you will create.
The class com.gooddata.rest.upload.Uploader performs the same functions, but in a much less verbose way. This is recommended for production purposes.
Last thing that might be a little bit tricky is how to find the "your_project_id" parameter of the NamePasswordConfiguration class. The easiest way is to enter https://secure.gooddata.com/gdc/md. Then click on the name of your project, and you will see some hash in both the url and on top of the page. This is the ID.
If you want to verify name of the ETL interface, you can click further on "data" and "interfaces". However, it might be easier to copy&paste it from the Data tab of the application.
I hope that this is helpful
ZD
Comments
Updated on March 4, 2010
New version updated on June 17, 2010 for Release 31
Hi there,
I have been trying to implement this, but the ETL uri in my dataSets is always null.
If I navigate to a previous upload, it has an ETL uri, but I can't use this one for a new upload.
Any hints on how to get the proper etl uri for the datasets?
Cheers,