Exclude deleted comment from bitbucket query result - bitbucket-api

I want to filter out deleted comment from a bitbucket cloud's pull request.
I tried the comment API endpoint: https://api.bitbucket.org/1.0/repositories/lereamede321/test-bitbucket-api/pullrequests/2/comments?q=deleted%3Dfalse&user.username%3Dleremede321. However, it does not support filtering on deleted field
I also tried activity API endpoint: https://api.bitbucket.org/2.0/repositories/leremede321/test-bitbucket-api/pullrequests/2/activity but it also includes updates, comments, etc. that I do not want. Also, I am unsure how to filter by type of the returned activities and filter by owner.
Is there a way to get around this?

Try use jq
curl -s -X GET "https://api.bitbucket.org/2.0/repositories/$REPO_OWNER/$REPO_SLUG/pullrequests/$PR_ID/comments?access_token=$AT" | jq ".values[] | select(.deleted==false)"

Related

Fetch Products under a specific Environment in an Organization - Apigee Edge

I am trying to fetch all the Products which are associated to an Environment under an organization.
I am able to fetch all the products in an organization but i don't seem to find a way in getting Environment specific Products.
You might think the 'Search API Products' API call would facilitate this, but I cannot make it work either. Docs: https://apidocs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/apiproducts
e.g., curl -X GET https://api.enterprise.apigee.com/v1/organizations/{my_org}/apiproducts?attributename=environments&attributevalue=prod
You can try putting the full URL after GET inside quotes ('') and it will work with curl

how to get all the files present for a particular commit id in bitbucket using rest API?

I want to get all the files present for a particular commit Id in bitbucket server using rest API. Is there any api to get the complete data ?
Hi you can use this..
rest/api/1.0/projects/{projectname}/repos/{reponame}/commits/{commit
id}/changes
The reply will contain (among other information) the details of each files modified in the commit.
As an example, this is the related section from the entire json output:
path: {components: ["file1.txt"],parent: "",name: "file1.txt",extension: "txt",toString: "file1.txt"},
You are looking for this endpoint: https://docs.atlassian.com/bitbucket-server/rest/6.4.0/bitbucket-rest.html#idp178
GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/archive?at={commitId}
With this you will get in default a zip file with all the files at this specific commit. Following the link you can get more information about the endpoint.

Does Firebase Realtime Database REST API support multi path updates at different entity locations?

I am using the REST API of Firebase Realtime Database from an AppEngine Standard project with Java. I am able to successfully put data under different locations, however I don't know how I could ensure atomic updates to different paths.
To put some data separately at a specific location I am doing:
requestFactory.buildPutRequest("dbUrl/path1/17/", new ByteArrayContent("application/json", json1.getBytes())).execute();
requestFactory.buildPutRequest("dbUrl/path2/1733455/", new ByteArrayContent("application/json", json2.getBytes())).execute();
Now to ensure that when saving a /path1/17/ a /path2/1733455/ is also saved, I've been looking into multi path updates and batched updates (https://firebase.google.com/docs/firestore/manage-data/transactions#batched-writes, only available in Cloud Firestore?) However, I did not find whether this feature is available for the REST API of the Firebase Realtime Database as well or only through the Firebase Admin SDK.
The example here shows how to do a multi path update at two locations under the "users" node.
curl -X PATCH -d '{
"alanisawesome/nickname": "Alan The Machine",
"gracehopper/nickname": "Amazing Grace"
}' \
'https://docs-examples.firebaseio.com/rest/saving-data/users.json'
But I don't have a common upper node for path1 and path2.
Tried setting as the url as the database url without any nodes (https://db.firebaseio.com.json) and adding the nodes in the json object sent, but I get an error: nodename nor servname provided, or not known.
This would be possible with the Admin SDK I think, according to this blog post: https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html
Any ideas if these atomic writes can be achieved with the REST API?
Thank you!
If the updates are going to a single database, there is always a common path.
In your case you'll run the PATCH command against the root of the database:
curl -X PATCH -d '{
"path1/17": json1,
"path2/1733455": json2
}' 'https://yourdatabase.firebaseio.com/.json'
The key difference with your URL seems to be the / before .json. Without that you're trying to connect to a domain on the json TLD, which doesn't exist (yet) afaik.
Note that the documentation link you provide for Batched Updates is for Cloud Firestore, which is a completely separate database from the Firebase Realtime Database.

Application Insights: Metadata queries through REST api

Is it possible to submit Application Insights metadata commands via the REST api? Is the best I can do just what is returned by GET /query/schema?
i.e
.show table requests | project AttributeName...
The syntax you asked for is part of the supported query language. For full listing of supported API, you can visit https://dev.applicationinsights.io.
If you need to programmatically query a table's schema you can use:
requests | getschema
Plugging it to the test tool yields the following request: https://dev.applicationinsights.io/apiexplorer/query?appId=DEMO_APP&apiKey=DEMO_KEY&query=%20customEvents%20%7C%20getschema%0A
Alternatively, you can query the whole schema in a single query by using https://dev.applicationinsights.io/apiexplorer/querySchema?appId=DEMO_APP&apiKey=DEMO_KEY. This will give you a list of all columns of all tables.
Out of curiosity - why would you want to do it through the REST API?
`

Is there any way to input the result got from the curl via fluentd?

We are seeking the most simple way for sending alfresco's audit log to elasticsearch.
I think using the alfresco supplying query and getting audit log would be most simple way.(since audit log data is hardly watchable on db)
And this query processes the effect measure as json type then I'd like to download the query direct using fluentd and send to elasticsearch.
I roughly understood that it would ouput at elasticsearc but I wonder whether I can download 'curl commend' using query direct at fluentd.
Otherwise, if you have other simple idea to get alfresco's audit log then kindly let me know.
I am not sure weather I understood it fully or not but based on your last statement I am giving this answer.
To retrieve audit entries from alfresco repository you could directly use REST APIs of Alfresco which allows you to access them.

Resources