2013
07.16

The GR8CONF US Hackathon is this Sunday, July 21st! If you have not registered yet, please sign up at the ChallengePost site! It officially starts at 6pm, but feel free to come to Target Plaza Commons at 1011 Nicollet Mall in downtown Minneapolis anytime after the GR8CONF workshops. You do not have to compete in the hackathon to attend the event. You are certainly welcome to just come hang-out at the hackathon. It will be a great opportunity to mingle with fellow Groovy enthusiasts and network with others in the community! There will be free food and beverages at the event. Hope to see you Sunday!

For those competing in the hackathon, I thought I would publish some basic examples of using the Target APIs with Groovy for participants to have as a reference. The following GitHub repo has some Spock tests using the Guests, Locations and Products Target APIs. There are many other parameters to call these APIs with as well as additional APIs that you can use during the hackathon. This is meant to be just a quick sample you can use to validate that your API (and Target.com for OAuth) credentials are working.

https://github.com/target/apitest

When you arrive at the hackathon, you will register for a developer account and get your credentials to make API calls (developer accounts won’t be approved until the event even if you register now). After you register and your developer account is approved at the hackathon by the Target API team, login to the developer portal and create an application. You will then be provided API keys for that application in the portal. Put the Consumer Key, Secret Key and User ID (the username you logged into the developer portal with) into Target.java (the Secret Key isn’t actually needed for the API tests we’ll be running though, just the Consumer Key and User ID). Next, you’ll need to create a Target.com guest account if you don’t already have an account on Target.com. Once registered, put your username and password into the “when” block in GuestsSpec.groovy. In that same file, put in your first name, last name and email that you used when registering on Target.com into the “then” block. With all this in place, now it’s time to run the tests via Gradle to make sure everything works! There is no need to have anything else installed but a JDK to run the test-suite as it leverages the Gradle wrapper.

./gradlew test (linux, osx)
gradlew.bat test (windows)

If all tests pass, you’re all set to start using any of the APIs documented in the Target developer portal at the hackathon! If you encounter any problems running these tests, please find a Target API team member to help you. I hope you have fun playing with Target APIs at the GR8CONF US Hackathon!