Getting all locked files using the BOX API (BOX.com) - locking

I am trying to find a solution to search/list all locked files in BOX (BOX.com).
As this seems not to be possible through the user-interface, I investigated the Rest API.
I cannot find a way to search for all locked files using the API.
I cannot iterate through the API.
I cannot have a wildcard search using the "fields=lock" as parameter.
Currently I can query if a single file is locked by:
https://api.box.com/2.0/files/26802142333?fields=lock
which returns
{
"type": "file",
"id": "26802142333",
"etag": "462",
"lock": {
"type": "lock",
"id": "22148533",
"created_by": {
"type": "user",
"id": "201274112",
"name": "Robert Wunsch",
"login": "rwunsch#sapient.com"
},
"created_at": "2015-05-11T11:36:08-07:00",
"expires_at": null,
"is_download_prevented": false
}
}
And I can create a search using the "fields=lock" parameter, with a query to search e.g. everything containing "xls":
https://api.box.com/2.0/search?query=xls&fields=lock
which returns
...,
{
"type": "file",
"id": "29299819893",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "26004664251",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "26004640461",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "29618844701",
"etag": "3",
"lock": {
"type": "lock",
"id": "22002195",
"created_by": {
"type": "user",
"id": "202820453",
"name": "Robert Wunsch",
"login": "gincalua#googlemail.com"
},
"created_at": "2015-05-06T05:33:28-07:00",
"expires_at": null,
"is_download_prevented": false
}
},
{
"type": "file",
"id": "26004659155",
"etag": "0",
"lock": null
},
{
"type": "file",
"id": "29063166840",
"etag": "0",
"lock": null
},
...
How do I can I search for the locked files?
Thanks for the Help!

I don't believe the API has a way of efficiently retrieving all locked files.
The only reliable solution would be to walk the entire folder tree and check each file to see if it's locked. However, this will be slow if you have a lot of files or a very deep hierarchy, as you'll need to make at least one API request per folder.

Related

Retrieving "Description" from BIM 360 via API on the Folder Contents, or Item, or Versions endpoint is not possible

When retrieving Folder Contents, or Item, or Versions in BIM 360 via API, the "Description" is not included. Any thoughts or updates?
Trying to get files metadata from BIM 360 - all going well except that the files' "Description" is not included.
{
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:-YFunNGUQf-64qpgkfeGMA",
"attributes": {
"displayName": "TP9-AST-105000-BB0A-MB-AR-LOCKERS.rvt",
"createTime": "2022-03-18T11:25:27.0000000Z",
"createUserId": "DFZGQKV2NRSF",
"createUserName": "Mohammed Irfan Mirza Baig",
"lastModifiedTime": "2023-02-01T12:38:11.0000000Z",
"lastModifiedUserId": "ZNAVNEM5G6JM",
"lastModifiedUserName": "Mirna Khoury",
"hidden": false,
"reserved": false,
"extension": {
"type": "items:autodesk.bim360:File",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.bim360:File-1.0"
},
"data": {
"sourceFileName": "TP9-AST-105000-BB0A-MB-AR-LOCKERS.rvt"
}
}
},

CoinGecko exchange rates conversion

I already seen the CoinGecko documentation but it does not contain explaination or in depth explaination on their API Documentation.
Regarding on CoinGeckos API, their is exchange_rates but it is only applicable for Bitcoin (BTC) to other currencies, my concern is, is there a ways to make any conversion from XRP to AUD base on this response?
https://api.coingecko.com/api/v3/exchange_rates
Also they have a link to make conversion but I don't know how they make it work.
I think I found the solution
The API returns an object with the list of rates:
{
"rates": {
"btc": {
"name": "Bitcoin",
"unit": "BTC",
"value": 1,
"type": "crypto"
},
"eth": {
"name": "Ether",
"unit": "ETH",
"value": 15.108,
"type": "crypto"
},
"ltc": {
"name": "Litecoin",
"unit": "LTC",
"value": 243.364,
"type": "crypto"
},
"bch": {
"name": "Bitcoin Cash",
"unit": "BCH",
"value": 66.392,
"type": "crypto"
},
"bnb": {
"name": "Binance Coin",
"unit": "BNB",
"value": 114.554,
"type": "crypto"
},
"eos": {
"name": "EOS",
"unit": "EOS",
"value": 8665.498,
"type": "crypto"
},
"xrp": {
"name": "XRP",
"unit": "XRP",
"value": 50657.684,
"type": "crypto"
},
"xlm": {
"name": "Lumens",
"unit": "XLM",
"value": 131419.329,
"type": "crypto"
},
...
}
So inorder to get the currency value for XRP to AUD, it needs to divide the 2 values, example AUD 45686.711 / XRP 50657.684 where the dividen should be the highest value
Sorry my bad, the conversion should be $to / $from there is no dividen format
Can someone confirm this as a solution?

How to generate HTML table for test execution summary in Email (Outlook) body

Background:
In our project[selenium-cucumber-java-Mvn based] we have test execution reporting done through- master thoughts Cucumber report (mvn dependency). This Report get generated in the test>target directory and we are sharing this folders Link embed in an email to everyone automatically for reporting. Here recipient has to open this link to see the status. Link looks like-
http://localhost:63342/Automation/TestExecutionReports/02-08-2018/Run-1/cucumber-html-reports/overview-features.html
Question:
Now we have a need to send Execution summary also in the email so that one can see high level status without even drilling through Link.
So we need to insert a Tabular format- with columns -TC Name, Status, Execution Time, Overall Count etc. in email body itself in addition to the above Link.
Can someone plz help me doing this?
Other info:
I don't know much how internally master though works, but it gathers the execution data via a JSON file. And we are generating this report in the onExecutionfinish method of TestNGExecutionListener.
our current report looks like an attached snap.
Our json is contains the following info-
[
{
"line": 1,
"elements": [
{
"before": [
{
"result": {
"duration": 3849355155,
"status": "passed"
},
"match": {
"location": "CucumberHooks.InitBrowser()"
}
}
],
"line": 3,
"name": "Add Account and verify details",
"description": "",
"id": "add-account-and-verify-details;add-account-and-verify-details",
"after": [
{
"result": {
"duration": 129904,
"status": "passed"
},
"match": {
"location": "CucumberHooks.TearDownTest(Scenario)"
}
}
],
"type": "scenario",
"keyword": "Scenario",
"steps": [
{
"result": {
"duration": 13810592966,
"status": "passed"
},
"line": 5,
"name": "I have Logged in to Grid application",
"match": {
"location": "leaseSearchSteps.i_have_Logged_in_to_Grid_application()"
},
"keyword": "Given "
},
{
"result": {
"duration": 4659413417,
"status": "passed"
},
"line": 6,
"name": "I select Accounts and Contacts option from the Homepage",
"match": {
"location": "createAccountSteps.selectAccountsAndContactsOptionFromTheHomepage()"
},
"keyword": "And "
},
{
"result": {
"duration": 3470670155,
"status": "passed"
},
"line": 7,
"name": "Click on Add Account button",
"match": {
"location": "createAccountSteps.clickOnAddAccountButton()"
},
"keyword": "Then "
},
{
"result": {
"duration": 28732919407,
"status": "passed"
},
"line": 8,
"name": "Create Account with Account name as \"Pacific UAT Test Account\"",
"match": {
"arguments": [
{
"val": "Pacific UAT Test Account",
"offset": 37
}
],
"location": "createAccountSteps.createAccountWithAccountName(String)"
},
"keyword": "Then "
},
{
"result": {
"duration": 2243415294,
"status": "passed"
},
"line": 9,
"name": "Click on View button",
"match": {
"location": "createAccountSteps.clickOnViewButton()"
},
"keyword": "Then "
},
{
"result": {
"duration": 121318771,
"status": "passed"
},
"line": 10,
"name": "Verify the newly created Account name",
"match": {
"location": "createAccountSteps.verifyTheNewlyCreatedAccountName()"
},
"keyword": "Then "
}
],
"tags": [
{
"line": 2,
"name": "#Test"
}
]
}
],
"name": "Add Account and verify details",
"description": "",
"id": "add-account-and-verify-details",
"keyword": "Feature",
"uri": "src/test/resources/cucumber/featureFiles/AU/addAccountAndVerify.feature"
}
]
I dont have code but I think a probable approach can be like below-
First write some code to generate Table Template with its Header, Main Table, Rows and Columns and Footer.
Then insert the Data into this table by reading it from the features.html page you have (as mentioned in url ). You should be able to read data for pass, fail or whatever needed from this html web page through standard methods [like- getText()] of Selenium .
In the end get this whole table appended to a StringBuilder and send in email message as bu using setting content of thmlSourceEmbed as text/html..hope this help

How to get number of googleplus page followers?

is there actually a possibility to get the number of followers of my googleplus-page. the following script - which I found here in an earlier post - doesn't work (no output):
$google_api_key = 'XYZXYZXYZXYZXYZXYZ';
$page_id = 'MYNUMERICPAGEID';
$data = #file_get_contents("https://www.googleapis.com/plus/v1/people/$page_id?key=$google_api_key");
$data = json_decode($data, true);
echo $data['plusOneCount'];
thank you!
There could be a few things wrong:
Don't have an updated project on the Developer Console.
Didn't enable the API for that project.
Are past thresholds/quotas.
Try the following:
Login to your Google Developers Console
You'll need a project.
If you don't have a project, create one.
Enable "Google Plus API" on that project.
Confirm usage/quotes are within tolerance and you haven't gone past.
From there, your call should work as normal:
GET https://www.googleapis.com/plus/v1/people/{USER_ID}?key={YOUR_API_KEY}
In my case, I'm querying Google's's page, so {USER_ID} = 116899029375914044550. I can then see the plusOneCount:
{
"kind": "plus#person",
"etag": "\"RqKWnRU4WW46-6W3rWhLR9iFZQM/bTf-sq_Sg3fLAFijixPfjtKM5f8\"",
"urls": [
{
"value": "http://www.google.com",
"type": "website",
"label": "www.google.com"
},
{
"value": "http://www.google.com/support/",
"type": "other",
"label": "Google Help"
},
{
"value": "http://googleblog.blogspot.com/",
"type": "other",
"label": "Official Blog"
},
{
"value": "http://twitter.com/#!/google",
"type": "other",
"label": "#google"
},
{
"value": "http://www.google.com/about/corporate/company/",
"type": "other",
"label": "Company Info"
},
{
"value": "http://www.google.com/press/",
"type": "other",
"label": "News"
},
{
"value": "http://www.google.com/press/google-directory.html",
"type": "other",
"label": "More Google pages"
}
],
"objectType": "page",
"id": "116899029375914044550",
"displayName": "Google",
"tagline": "News and updates on Google's products, technology and more",
"aboutMe": "<p>Welcome to Google's official page. Here, you'll find product news and announcements, company updates, glimpses into what it's like to work at Google, discussions on technology and the web, and much more. </p><p><span>Given the volume of feedback we receive here, we may not be able to respond individually to every comment and we're not able to provide product support (if you're having product issues, please visit our Help Center). Rest assured we're paying attention, and we're always eager to hear from you.</span></p>",
"url": "https://plus.google.com/+google",
"image": {
"url": "https://lh4.googleusercontent.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAAC9wQ/JD8tdz3bFTM/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"plusOneCount": 10757884,
"circledByCount": 7692912,
"verified": true,
"cover": {
"layout": "banner",
"coverPhoto": {
"url": "https://lh4.googleusercontent.com/-PLPoXvnN0XI/UTdr4xTtuHI/AAAAAAAA_1U/p1n_Za3BZUg/s630-fcrop64=1,00000000fe06fe97/g_plus_background.png",
"height": 528,
"width": 940
},
"coverInfo": {
"topImageOffset": 0,
"leftImageOffset": 0
}
}
}

How to invert the MQL query (for freebase)?

I am trying to list all the types for a particular id:
{
"id": "/en/sony",
"type": [{
"name": "Topic",
"id": null
}]
}
This query giving me the following result:
http://tinyurl.com/lubavey
{
"result": {
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/base/audiobase/topic",
"name": "Topic"
},
{
"id": "/base/fblinux/topic",
"name": "Topic"
},
{
"id": "/base/digitalcameras/topic",
"name": "Topic"
},
{
"id": "/base/popstra/topic",
"name": "Topic"
},
{
"id": "/base/televisions/topic",
"name": "Topic"
},
{
"id": "/base/ps3games/topic",
"name": "Topic"
},
{
"id": "/base/filmcameras/topic",
"name": "Topic"
},
{
"id": "/m/04mny2g",
"name": "Topic"
}
],
"id": "/en/sony"
}
}
I want exactly the opposite result. I want all the types which do not have name as "Topic" with them.
How can I achieve this? I tried to use ! operator with property name which is suggested in reference guide of MQL, but it's giving me error:
"Can't use unqualified property names with ! reversing".
What should I do to remove this error with ! and to obtain opposite result of the query?
Try with !=:
{
"id": "/en/sony",
"type": [{
"name!=": "Topic",
"id": null
}]
}
The != operator says that the constrained property can be anything but
the specified value. (It does require that the property be something,
however: it does not match object for which the property is null.)
Read more about != operator here: http://wiki.freebase.com/wiki/MQL_operators#The_.22but_not.22_Operator_.21.3D