Google Drives API - retrieve files owned by me - google-drive-api

Using the Google Drives API, how do I formulate Q when retrieving the file listing, to only get back files that are owned by me?

I believe your goal as follows.
You want to retrieve the files that you are the owner using the method of "Files: list" in Drive API.
You want to create the search query for achieving this.
For this, how about this answer?
In this case, you can create the search query using owners in the fields.
Sample search query:
'me' in owners
If you want to retrieve the files in the specific folder, you can use the following search query.
'###' in parents and 'me' in owners
Sample curl:
curl \
'https://www.googleapis.com/drive/v3/files?q=%27me%27%20in%20owners&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
and
curl \
'https://www.googleapis.com/drive/v3/files?q=%27%23%23%23%27%20in%20parents%20and%20%27me%27%20in%20owners&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
Note:
If you want to retrieve the folder without publicly sharing, please use the access token instead of the API key. Please be careful this.
References:
Files: list
Search for Files

Related

How to get the mobile and desktop API path in page speed insights?

Hi i just want to ask if there's seperated API in pagespeed insight in performance score? Because i only seeing this path to consume in performance score and i don't know if it's for desktop or mobile
lighthouseResult.categories.performance.score
To determine the strategy from result, we can refer to lighthouseResult.emulatedFormFactor
By default it runs for DESKTOP.
To make it run for MOBILE, there exists a query param strategy
Here's sample request for strategy=MOBILE
curl \
'https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?url=https%3A%2F%2Fexample.com&strategy=MOBILE&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
Reference: here

How I can list all added apps in javamelody monitoring using curl command?

curl -vkg http://collectserver/ -H 'Authorization: Basic abc123==' -d "appName=APP_NAME&appUrls=http://myhost/myapp/"
This is working curl to add apps in javamelody monitoring
And I also tested for delete application
curl -v
"http://collectserver/collectServer?action=remove_application&application=$APP_NAME" -H 'Authorization: Basic abdvcgvh'
Now I want to create curl to list all added application using curl command plz help
You can call the same URL with the parameters "?part=applications&format=json" or "?part=applications&format=xml"
You will get a map in json, which lists the applications as keys.
For example, curl -v "http://collectserver/collectServer?part=applications&format=json" -H 'Authorization: Basic abdvcgvh'

IBM QRadar search event using APIs

I wanted to know if it is possible to search for an Event using IBM QRadar APIs. please find the screenshot below as an example.
in the above, image when we hit the search button, we will get over events which contain text in the text bar. I want to do the same thing with the help of API. please help.
I found the answer to my question-
to fetch the payload or Event information via QRadar APIs first use the search API to get the search ID
curl --location --request POST 'https://qradar-2.as.local/api/ariel/searches?query_expression=select%20payload%20from%20events%20WHERE%20UTF8%28payload%29%20ILIKE%20%27%25xyz-xyzzyx-07.xy.as.local-51995-596966-1%25%27%20START%20%272020-08-21%2004%3A00%27%20STOP%20%272020-08-21%2006%3A00%27%20' \
--header 'Version: 12.0' \
--header 'Accept: application/json' \
--header 'SEC: {{your token here}}' \
--header 'Cookie: JSESSIONID=F988AE8612EDF61A67249876B783CEA7'
then use this search ID in the API below
curl --location --request GET 'https://qradar-2.as.local/api/ariel/searches/{{search_id}}/results' \
--header 'Range: items=0-49' \
--header 'Version: 12.0' \
--header 'Accept: application/json' \
--header 'SEC: {{your token here}}' \
--header 'Cookie: JSESSIONID=E6568B30B3615UUIUD5672AB56578F9E66'
now the response of this API will be base64 encoded so you visit any site to decode.
eg. https://www.base64decode.org/
hope this will help people

Restrict shared links to collaborators only through box API

I am trying to setup a pre-configured folder for users in the Enterprise where the share options are limited to collaborators only.
This feature is available in the web interface in the folder properties form under the security tab: "Restrict shared links to collaborators only"
The box content API (v2) allows for the creation and modification of shared links, this works as expected; but it is not clear whether/how we can restrict the shared link options.
The API docs for folder update: developers.box.com/docs/#folders-update-information-about-a-folder appears to indicate that there is an access attribute on the folder in addition to the shared_link attribute:
access: Can be open or collaborators. Type: object
I am not sure what the object value would be if not the "collaborators" String.
I have tried:
curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "As-User: USER_ID" \
-d '{"access": "collaborators"}' -X PUT
and
curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "As-User: USER_ID" \
-d '{"access": {"access": "collaborators"}}' -X PUT
both return a status 200, though they do not appear to do anything.
The access field is actually a sub-field of the shared_link field, which is why it's slightly indented in the documentation (this is kind of hard to see). If you want to create a shared link to a folder and restrict the access to collaborators, you can do so with a request like:
curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "As-User: USER_ID" \
-d '{"shared_link": {"access": "collaborators"}}' -X PUT

Is it possible to tag TeamCity builds using service messages (or some other programatic way)?

Is it possible to tag TeamCity builds using service messages or some other programmatic way from a build step maybe...?
How can this be done?
See also the following stackoverflow discussion:
Programatically pin a build in Teamcity
Moreover, since there were two open questions on stackoverflow and I had the same problem, I wrote a TeamCity plugin that solves it:
https://github.com/echocat/teamcity-buildTagsViaBuildLog-plugin
There is a VCS labelling in TeamCity, you can tag when a build successful, or on each build. Does it correspond to what you're looking for?
Yes, there is. You can use the REST API, as described here. Basically,
Adding a tag using plain text
curl -s --header "Authorization: Bearer $TOKEN" \
-H 'Content-Type: text/plain' \
"https://ci.ACME.com/app/rest/builds/5375/tags --data tag-1
tag-1
Reading the list of tags as json
curl -s -H 'Accept: application/json' \
-H "Authorization: Bearer $TOKEN" \
"https://ci.ACME.com/app/rest/builds/5375/tags"
{"count":1,"tag":[{"name":"tag-1"}]}
Overwriting tags using json, getting it back as xml (the default)
curl -s --header "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' -X PUT \
"https://ci.ACME.com/app/rest/builds/5375/tags \
--data '{"count":2,"tag":[{"name":"tag-A"},{"name":"tag-B"}]}'
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><tags count="2"><tag name="tag-A"/><tag name="tag-B"/></tags>