How to use "q" Query parameter in Bitbucket REST API? - bitbucket

So I am aware of the fact that you can get the files in a repository by using
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}
API.
The API also supports the q parameter where you can query the resulting json object based on various fields in it.
I wanted to know if one can use this query parameter to fetch the files based on certain extensions?
Like the JSON object also contains a field "mimetype" which defines the mime type of the files.
I did use the following API call
https://api.bitbucket.org/2.0/repositories/{workspace}/openapi/src/master/?max_depth=100&q=path+%7E+%22.js%22&pagelen=100
To fetch all the files which contain the string ".js" in the path parameter.
But while querying the mimetype parameter I was not able to do the same using
https://api.bitbucket.org/2.0/repositories/{workspace}/openapi/src/master/?max_depth=100&q=mimetype+%3D+%22application%2Fjavascript%22&pagelen=100
This call returned error.
Can anybody let me know how can you query based on mimetype or if possible fetch the files based on extension
Note: I know about the Code search API but that is not an option as it has large limitations.

Related

multiple exclude data can't catch in filter option odata

I create smart table sapui5 screen by using odata (S4Hana) .
On the odata side, get the filter value from smart filter by using this method ⇒ [ io_tech_request_context->get_filter( )->get_filter_select_options( ).]
It is ok when I pass the filter value as multiple Include option .
When I pass the filter value as multiple Exclude option , the data can't access from filter_select option method. The data can be get in filter_string method but it is difficult to get the data and put to range table .
Let me know how to get the filter value from entity set of odata .
Let me know how to get the filter value from entity set of odata .
There are defined rules, how your $filter parameter has to look like to get converted into the import parameter it_filter_select_options. If you breach this rules (you did...) the import parameter it_filter_select_options will be empty.
Sadly, there's no simple solution.
If you need to convert the parameter iv_filter_string into select options there are quite a few Tutorials/Blogs about it.
Filter String How To
How to Parse IV_FILTER_STRING in GET_ENTITYSET

Take all data from Zapier Storage

I need to get all the data from StoreClient (Javascript). The format of the data on the below picture, they are in Zapier Storage.
const store = StoreClient('mysecret');
const value = await store.getMany('mykey'); // or store.get('mykey')
return {result: value}
This code works well. But I need to take and process all stored keys in a loop along with all their child value. I did not find a way :(
I tried store.list_pop(key), but the lists have a different storage format. And the data is not retrieved.
I would recommend using Zapier's storage API which will allow you to retrieve all stored data through a GET request to https://store.zapier.com/api/records. I often have to do the same thing and this works for me.
Have a look at their documentation here. I typically code in Python using the requests library. But I'm sure you could achieve similar results using an ajax or fetch request in Javascript.
EDIT
If I am understanding your question correctly you are trying to 'GET' all of your data stored in Zapier's storage client. As per their API documentation:
Zapier stores your data as a dictionary object which can hold key value pairs. Those values can also be nested dictionaries or lists. Regardless of how you store the data (simple key value pairs, nested lists, nested dictionaries, or some combination of the preceding) a 'GET' request will return the entire object. As stated before I typically use Python's request library to handle HTTP requests but I was able to achieve the same result using a Javascript fetch request. I setup a dummy storage account at https://store.zapier.com/api/records?secret=dog to test and illustrate how this works. See my code below.
var url = "https://store.zapier.com/api/records?secret=dog";
const res = await fetch(url);
const body = await res.json()
return {JSON : body}
Unfortunately, due to my lack of familiarity with Javascript I had to bake the secret into the url, which I don't think is ideal, but for the purposes of this example it does the job. See my output below.
As you can see the 'GET' request returned all data stored in my Zapier storage account. I simply returned the data I retrieved from the 'GET' request but you could of course loop through the results and execute logic as needed. This does not modify any of the data stored, what I often do is pull in all of my stored date with a 'GET' request, modify it, delete the old storage, and 'POST' my modified storage information. This allows me to limit my requests to two calls rather than modifying each individual value.

Query single entity through Breeze+Odata via .../Entity/1L url

I am trying to load a single entity by its key from an OData server using BreezeJS. After some research, it seems that EntityQuery.fromEntityKey is the proper approach (since I also would want to add expand).
The intended query URL would be http://.../Customer(1L)?$expand=....
However with the following code:
let query = EntityQuery.fromEntityKey(new EntityKey("Customer", id)).expand("...")
return <Promise<Customer>><any> this.entityManager.executeQuery(query)
the URL is
http://.../Customer?$filter=CustomerId eq 1L & $expand=...
which is not entirely incorrect, but different from what would normally be used to request an entity.
How can Breeze be configured/called to get the "correct" URL?

IOS/Objective-C/JSON:Obtain single value from Web Service in JSON

I want to obtain a single value from a web service in JSON, just a file name i.e. "picture.png"; based on some parameters passed.
Can IOS (I guess NSJSONSerialization JSONObjectWithData:) handle this single value in JSON or on the server side should I have it send a dictionary key as in {"pic": "picture.gif"}
If there is no picture, I am returning "nopic" so again should I have it return "error" or {"error": "nopic"}
I gather the various JSON specifications are conflicting on this point so my interest is just practical...how best to handle this case.
Thanks for any guidance on this

Jira issues in JSON format (Need to know thw classes and functions called by I am trying to use the REST API "api/2.0.alpha1/issue/{issueKey}"

I am trying to use the REST API api/2.0.alpha1/issue/{issueKey} .
Reference: http://docs.atlassian.com/jira/REST/4.4.3/#id2413591
I would get all issue id's from rest/api/2.0.alpha1/search
Using these issue IDs get all issues in JSON format.
But as I am using localhost (local Machine) I do not want to make network calls and increase network traffic. Hence I wanted to know which class in JAVA does these URIs call so that I can directly call these classes to get the issues in JSON format.
Basically I want all the issues in JSON format without network calls.
OR
I also have all the issue retrieved in issues object but not in JSON format. How can I convert that into JSON format?
I have found the following code from JIRA:
#GET
#Path ("/{issueKey}")
public Response getIssue(#PathParam ("issueKey") final String issueKey)
{
final Issue issue = getIssueObject(issueKey);
final IssueBean bean = createIssue(issue);
return Response.ok(bean).cacheControl(never()).build();
}
You could search the source code for the #GET references or use the REST API browser (https://developer.atlassian.com/display/RAB/Overview+of+the+Atlassian+REST+API+Browser)
but accessing the classes from Java probably means that you need to be running in the same class loader as JIRA or using a plugin.
Have you measured the overhead of the calls to make sure that you are not optimizing prematurely?

Resources