Get raw file content using Stash Rest API - bitbucket-server

I am able to get raw file content using the Bitbucket REST API, as
https://api.bitbucket.org/1.0/repositories/AccountName/Repo_Slug/raw/master/MyFolder/MyFile.cs,
Is there a equivalent to get it from Stash using Stash Rest API. I couldn't find it here:
https://developer.atlassian.com/static/rest/stash/2.0.1/stash-rest.html#resources

Just specify the file's URL and append ?raw
http://example.com/projects/TES/repos/testrepo/browse/testfile?raw
As I mentioned, that is not a function of either REST API, it is just the full URL of the file.

With 1.0 of stash/bitbucket api, you could use the below to get the raw file content
https://example.com/rest/api/1.0/TES/repos/testrepo/raw/testfile?at=feature/branch

Related

Bitbucket server rest api retrieving commit data from a tag that contains slashes

I am trying to retrieve commit data for a tag that has slashes in the name using BitBucket REST API for bitbucket server.
Ex tag:
release/2020-09-23-v3.13.4
I am using the following rest URL for a GET request but getting a 404 error.
https://git.server.com/rest/api/1.0/projects/TEST/repos/test/commits/release/2020-09-23-v3.13.4
Is there a way I can properly format this call to retrieve the commit data for the tag above?
Thank you so much for your help.
According to the docs this one should work
https://git.server.com/rest/api/1.0/projects/TEST/repos/test/tags/release/2020-09-23-v3.13.4

How can I get a JSON response from Github's REST API?

I'm trying to use this guide to get a list of all issues from a repository. For example, let's look at the facebook/react repository.
When I do a GET request to https://github.com/facebook/react/issues/ it just returns the web page, but what I want is a JSON with all the issues.
How can I get a JSON response?
You need to use the API's root endpoint, on the api subdomain:
GET https://api.github.com/repos/facebook/react/issues
^^^^

SoftLayer API - retrieve invoices

I am using SoftLayer_Billing_Invoice::getPdfDetailed to retrieve the latest invoice, but the file does not seem to be a binary file. How to decode that file and get it opened.
that depends on if you are using a Softlayer client or if you are using simple REST request, using a simple REST request the response is encoded in base64 and you must decode it (you could try using this online tool http://www.motobit.com/util/base64-decoder-encoder.asp and export the result in a file)
Now if you are using a Sofltyer client such as Softlayer's Python or Ruby client they are using xmlrpc for the request and they uses its own data type to store that data you can see an example about that using the Python client here How to get "PDF" file from the binary data of SoftLayer's quote?
Regards

Get non file body from multipart/form-data using AWS API Gateway and Lambda

I am trying to get the form data from a multipart/form-data POST to my ASW Lambda web service via API Gateway.
The HTTP POST has Content-Type "multipart/form-data" and body that is URL encoded. File data is also sent in this post (hence the multipart, I guess).
The web service needs to integrate with a thirdparty service, so changing the format of the POST isn't really an option.
I have seen this thread talking about converting the URL encoded data to JSON object for use in Lambda, but this doesn't do the trick.
I have also tried setting the Integration Request -> Mapping Templates for content type multipart/form-data to Input passthrough. This didn't help either.
I did come across another question about uploading a file using multipart/form-data, but since I'm not interested in the file, just the body, that answer didn't help.
Below find screenshot (sorry) of the captured post via runscope.
If the goal is to use Lambda, you'll need to pass valid JSON to the function. Currently there isn't a way to JSON-ify data inside Api Gateway that comes in as non-JSON data.
Our short term fix (on our backlog) is to provide a variable in the mapping templates to grab the raw input of the request. That way you could do a simple JSON conversion using a template like:
{
"body" : "$input.body"
}
or something like that.
Check out the mapping template reference for more info: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
Edit 4/7 - feature has been released as $input.body

Google Storage Json Api - access "folders" from api fails?

I am having problems accessing objects that use slashes through the api. For example I have objects with the names "folder1/folder2/name". When I use this with the api I get a 400 bad request. Is this not supported yet by the Api? or is a special character needed? This also fails for me on the API explorer.
This is a URL encoding issue. The object name is a single URL path part, and thus all slashes in the name need to be %-encoded. (i.e., folder1%2ffolder2%2fname)
API explorer, unfortunately, has a known issue (reported internally) with storage.objects.get. The method returns actual file data, and the API explorer is expecting JSON metadata and things go poorly from there.