0

For example, I have a URL like this that works for a GET request: https://stash-server.com/rest/api/1.0/projects/something/repos/project/commits/develop/

This works for the develop branch, but when I try to do feature/something to access commits on that branch, it returns 404 not found.

Documentation is lacking, I am not able to find how to access branch names like this...

Thanks!

Carmageddon
  • 2,627
  • 4
  • 36
  • 56
  • What git command are you trying to run? – jmargolisvt Aug 09 '18 at 14:30
  • This is a REST GET API request, not via git client. – Carmageddon Aug 09 '18 at 14:31
  • 1
    Slashes are perfectly fine in branch names. The problem seems to be outside of git. – Romain Valeri Aug 09 '18 at 15:24
  • @RomainVALERI Well I double checked and triple checked, I did not mispell the branch name. I still get a 404 with XML message saying `null for uri: ...` If I were to replace branch with `feature-something`, then it says commit does not exist in repository... So obviously your reply is wrong – Carmageddon Aug 09 '18 at 16:11
  • Obviously? No. Slashes **are** perfectly fine in branch names for all purposes. The use case you're describing involves many other steps, like network / http request / Rest API / browser / others. "404 not found" is *not* a git error. That's what I meant by "outside of git". If you create a `feature-something` branch, it has nothing to do with your `feature/something` branch *per se*. – Romain Valeri Aug 09 '18 at 16:43

1 Answers1

0

The eventual solution/workaround, was to perform two REST calls, the first one to the /branches endpoint, iterate over the results to find the correct branch, and get the latestCommit hash, then make a REST call to commits/hashID - this works around this issue of no way to access branch names like feature/something directly via REST API.

Carmageddon
  • 2,627
  • 4
  • 36
  • 56