It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Where is Java Library with class definitions for Stash REST API response objects?

michael_giroux Aug 21, 2015

I'm trying to automate some tasks that will examine all repositories in all projects.  I have been using curl to invoke REST API to retrieve list of projects and repos.  I use python to process the json response.

Prototyping is complete and we are now implementing the code in Java.  I added the maven dependency for stash-api, but that only includes the Interface for Project, so I cannot deserialize the response.

What is the correct maven dependency to include a library with class implementations that I can use to deserialize the object?

String json_response = stash_rest_api_projects();

Gson gson = new Gson();

Project p = gson.fromJson(json_response, Project.class);

This results in the error:

Unable to invoke no-args constructor for interface com.atlassian.stash.project.Project. Register an InstanceCreator with Gson for this type may fix this problem.

 

1 answer

0 votes
Tim Pettersen Aug 21, 2015

Hi Michael,

The stash-api JAR contains the interfaces for the Java plugin API, not the REST API.

I'd recommend checking out the Stash REST API client from Atlassian Labs: https://bitbucket.org/atlassianlabs/stash-java-client

cheers,

Tim

Michael Giroux Aug 21, 2015

Thanks. I've cloned the repo and will take a look at it. Could you tell me where the repo is for the parent pom? com.atlassian.pom:public-pom

Tim Pettersen Aug 21, 2015

You may need to [install the Atlassian SDK|https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project] and either use the atlas-mvn command it comes packaged with, or copy over the settings from the embedded maven settings.xml file.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,964 views 1 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you