I was following the refference from google drive api v3 and trying to find the file name with format is .capx
here the api https://www.googleapis.com/drive/v3/files?q='FOLDER_ID'+in+parents&name='.capx'&pageSize=1000&fields=files(name,size,description,webContentLink,webViewLink,createdTime)&key=
output
{
"files": [
{
"name": "tes.zip",
"webContentLink": "",
"webViewLink": "",
"createdTime": "",
"size": ""
},
{
"name": "tes.capx",
"webContentLink": "",
"webViewLink": "",
"createdTime": "",
"size": ""
}
]
}
I want output like this
{
"files": [
{
"name": "tes.capx",
"webContentLink": "",
"webViewLink": "",
"createdTime": "",
"size": ""
}
]
}
You want to retrieve the files which has the extension of .capx using the search query of the method of files.list in Drive API.
If my understanding is correct, how about this answer? In this answer, 'FOLDER_ID' in parents and name contains '.capx' is used as the search query.
Modified endpoint:
https://www.googleapis.com/drive/v3/files?pageSize=1000&q='FOLDER_ID' in parents and name contains '.capx'&fields=files(name,size,description,webContentLink,webViewLink,createdTime)
or
https://www.googleapis.com/drive/v3/files?pageSize=1000&q=%27FOLDER_ID%27%20in%20parents%20and%20name%20contains%20%27.capx%27&fields=files(name%2Csize%2Cdescription%2CwebContentLink%2CwebViewLink%2CcreatedTime)
References:
Files: list
Search for files and folders
If I misunderstood your question and this was not the result you want, I apologize.
Related
I tried using the example get method on the google drive api documentation, however what is returned is not the full metadata of the file, only this:
"kind": "drive#file",
"id": "1vbLiXALYOYoVev1KD_ajVBfh5_CgvGgP",
"name": "3.png",
"mimeType": "image/png",
"result": {
"kind": "drive#file",
"id": "1vbLiXALYOYoVev1KD_ajVBfh5_CgvGgP",
"name": "3.png",
"mimeType": "image/png"
}
}
What should appear is something with many more fields:
{
"kind": "drive#file",
"id": "1vbLiXALYOYoVev1KD_ajVBfh5_CgvGgP",
"etag": "\"MTU4Njg3NTU3MjUxOQ\"",
"selfLink": "",
"webContentLink": "",
"alternateLink": "",
"embedLink": "",
"iconLink": "",
"thumbnailLink": "",
"title": "3.png"
// ... and so on
I get the full response when I use the "try api" screen on the api docs, but not when calling it from javascript:
function printFile(fileId) {
appendPre(fileId)
var request = gapi.client.drive.files.get({
'fileId': fileId
});
request.execute(function(resp) {
console.log(JSON.stringify(resp, null, 2))
});
}
I used the https://www.googleapis.com/auth/drive.file scope, which is listed as a scope sufficient for the request to be completed. Help!
How about this modification?
At Drive API V3, when fields property is not used, a part of fields is returned. So in your case, for example, you can retrieve other parameters using fields: "*". When your script is modified, please modify as follows.
From:
var request = gapi.client.drive.files.get({
'fileId': fileId
});
To:
var request = gapi.client.drive.files.get({
'fileId': fileId,
'fields': "*" // Added
});
Reference:
Parameters of Files: get
I have been tried to get Area objects from Sheets (3D Submission) of Revit file through Forge API. Using this link GET /modelderivative/v2/designdata/{urn}/metadata/{guid of sheet}/properties the Area Information isn't there, even though i have added the area in sheets.
My goal is marking the Area in 2D / Sheets (3D Submission). How can i do that ?
The Area, i mean like this >> marking The Area in 2D
The area object looks like Revit Room or Revit Zoom. If your zoom or room is clickable on the Viewer, then you can obtain its properties via the API Get Properties. Here are a few steps I used to archive what you want, you can compare if there is something you missed.
Check the room/area elements are valid in your Revit sheet. A room/area should be enclosed by walls or Room Separation/Area Boundary.
Make sure the sheet which contains your room/area is included in the set of the Revit Publish Setting
Upload the well-configurated RVT to Forge for translation.
After translation was completed, load the sheet view (called A102 - Plans in this case) via Forge Viewer, and make sure that room/area elements in the view are clickable.
Retrieve the objectId of selected room/area via viewer.getSelection(). The objectId of the selected room/area in this view is4089` for example.
Call API GET :urn/metadata to get sheet's guid. Now it's abdacd31-f94c-e84f-9a58-4663e281d894 for instance.
{
"data": {
"type": "metadata",
"metadata": [
{
"name": "{3D}",
"role": "3d",
"guid": "6bfb4886-f2ee-9ccb-8db0-c5c170220c40"
},
{
"name": "A102 - Plans",
"role": "2d",
"guid": "abdacd31-f94c-e84f-9a58-4663e281d894"
}
]
}
}
Call API GET :urn/metadata/:guid to obtain instance tree of that view, and check if there is a room/area with the id we want. e.g. the room named as Kitchen & Dining 101 [857279] and id is 4089 in the API response.
{
"objectid": 4084,
"name": "Rooms",
"objects": [
{
"objectid": 4085,
"name": "Bath 203 [857200]"
},
{
"objectid": 4086,
"name": "Bath 205 [857203]"
},
{
"objectid": 4087,
"name": "Bedroom 202 [857206]"
},
{
"objectid": 4088,
"name": "Entry Hall 201 [857209]"
},
{
"objectid": 4089,
"name": "Kitchen & Dining 101 [857279]"
}
]
}
Call API GET :urn/metadata/:guid/properties in this way to retrieve properties of the room/area. For example, /modelderivative/v2/{YOUR_RVT_URN}/metadata/abdacd31-f94c-e84f-9a58-4663e281d894/properties?objectid=4089 and its response is shown as below, then you will see area which you want is showing in the response.
{
"data": {
"type": "properties",
"collection": [
{
"objectid": 4089,
"name": "Kitchen & Dining 101 [857279]",
"externalId": "e6ac360b-aaed-4c3b-a130-36b4c2ac9d13-000d1467",
"properties": {
"Constraints": {
"Base Offset": "0.000 mm",
"Level": "Level 1",
"Limit Offset": "6500.000 mm",
"Upper Limit": "Level 1"
},
"Dimensions": {
"Area": "26.971 m^2",
"Computation Height": "0.000 mm",
"Perimeter": "29060.000 mm",
"Unbounded Height": "6500.000 mm",
"Volume": "118.317 m^3"
},
"Identity Data": {
"Base Finish": "",
"Ceiling Finish": "",
"Comments": "",
"Department": "",
"Floor Finish": "",
"Image": "",
"Name": "Kitchen & Dining",
"Number": "101",
"Occupancy": "",
"Occupant": "",
"Wall Finish": ""
},
"Phasing": {
"Phase": "Working Drawings"
}
}
}
]
}
}
Hope it helps~
I'm tried to use this PATCH Api to rename item of "A360".
It returns 200 with DisplayName updated, but on myhub.autodesk360.com the item seems rendered with "Name" property of json object "Included".
this is the request body :
{
"jsonApi": {
"version": "1.0"
},
"data": {
"id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
"type": "items",
"attributes": {
"displayName": "new_item",
"name" : "new_item"
}
}
this is the response :
"data": {
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
"attributes": {
"displayName": "new_item",
"createTime": "2017-10-25T09:04:35.0000000Z",
"createUserId": "QY23PAJ2YB4G",
"createUserName": "bot#autodesk360.com",
"lastModifiedTime": "2017-11-30T09:00:46.0000000Z",
"lastModifiedUserId": "AYLNNU3UK324",
"lastModifiedUserName": "Giuseppe Signorelli",
"hidden": false,
"extension": {
"type": "items:autodesk.core:File",
"version": "1.0",
"schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.core:File-1.0"},
"data": {}
}
}
and object included :
"included": [ {
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.tMqu2aQEToa3XsRmKzTTRg?version=2",
"attributes": {
"name": "House Design.rvt",
"displayName": "House Design.rvt",
"createTime": "2017-11-09T16:50:30.0000000Z",
"createUserId": "AYLNNU3UK324",
"createUserName": "gsignorelli#tierratelematics.com",
"lastModifiedTime": "2017-11-09T16:50:34.0000000Z",
"lastModifiedUserId": "",
"lastModifiedUserName": "",
"versionNumber": 2,
"mimeType": "application/vnd.autodesk.revit",
"storageSize": 12550144,
"fileType": "rvt",
"extension": {
"type": "versions:autodesk.core:File",
"version": "1.0",
"schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.core:File-1.0"},
"data": {}
}
}
I expected that on my client show same result that A360 shows.
If I understand correctly, you are trying to use PATCH API to rename the item name of BIM360 Docs, right? As far as I know, currently, PATCH APIs are only working on A360, they are not currently supported or encouraged for BIM 360 Docs. There might be a chance that allows for a folder rename, but it does not properly update the Docs database. So we do not recommend to use that APIs for BIM 360 Docs, and if you want to change a file name, I suggest you to upload a new version instead.
If you want to update the file name in A360, you should use PATCH API to a version, not an item. Here is what I tried, and the name of the file version is updated correctly:
PATCH API to update the name of the version, the trick thing is that you need to URL encode the version id in the endpoint, you can use any tools like https://meyerweb.com/eric/tools/dencoder/ to do that. This is different as the PATCH API to item.
Once you get the 200 status, your file name should be updated correctly in A360 as shown in the following picture:
I am using the Google Drive API. I can get a list of files with the drive.files.list API method. Here is the result of a call to this method:
{
"files": [
{
"id": "1yLJFT2bHhsz1WxJX29mD9DiNz0vLDlBvzJf5GJCcboI",
"mimeType": "application/vnd.google-apps.spreadsheet",
"parents": [
"0Bwy7SlKkxnwQRld6RWljU0Y4TG8"
]
},
{
"id": "0Bwy7SlKkxnwQVXdBRmlPMGNoTmM",
"mimeType": "application/vnd.google-apps.folder",
"parents": [
"0B4jAnSzS-VxlZW9RcDJheU5FYW8"
]
},
{
"id": "0Bwy7SlKkxnwQRld6RWljU0Y4TG8",
"mimeType": "application/vnd.google-apps.folder",
"parents": [
"0Bwy7SlKkxnwQQndiQnYxbUF4SjQ"
]
}]
}
When I request individual files using the drive.files.get API call, I would expect to get the same results as shown in the list above. I do when I request the first and third file listed. For example:
GET https://www.googleapis.com/drive/v3/files/0Bwy7SlKkxnwQRld6RWljU0Y4TG8?supportsTeamDrives=true&fields=id%2CmimeType%2Cparents
Result:
{
"id": "0Bwy7SlKkxnwQRld6RWljU0Y4TG8",
"mimeType": "application/vnd.google-apps.folder",
"parents": [
"0Bwy7SlKkxnwQQndiQnYxbUF4SjQ"
]
}
This is identical to what is shown in the list. But for some reason when I request the second file in the list, the parents list is missing from the result:
GET https://www.googleapis.com/drive/v3/files/0Bwy7SlKkxnwQVXdBRmlPMGNoTmM?supportsTeamDrives=true&fields=id%2CmimeType%2Cparents
Result:
{
"id": "0Bwy7SlKkxnwQVXdBRmlPMGNoTmM",
"mimeType": "application/vnd.google-apps.folder"
}
No parents array. Can anyone explain this behavior? I assumed all files should have a parent.
If you haven't done yet, you may want to check if you have an access to the parent of your second file. As stated in Enabling Team Drives:
A parent does not appear in the parents list if the requesting user is a not a member of the Team Drive and does not have access to the parent.
In Behavioral differences, fields related to permissions and ownership are populated differently.
I am using the Sharefile REST API for a project and have run into an issue. Their documentation is lacking and so far my 5 emails to the api# address have gone unanswered. Figured I would crowdsource this one...
What I need to do is search for a file by its name and it also has to have a specific parentID. I am following their documentation as best I can, but I still get a 500 error on the response.
According to their API documentation I have to post to: https://account.sf-api.com/sf/v3/Items/AdvancedSimpleSearch with the following post:
{
"Query":{
"AuthID":"",
"ItemType":"",
"ParentID":"",
"CreatorID":"",
"LuceneQuery":"",
"SearchQuery":"",
"CreateStartDate":"",
"CreateEndDate":"",
"ItemNameOnly":"",
},
"Paging":{
"Key":"",
"PageNumber":1,
"PageSize":10,
},
"Sort":{
"SortBy":"",
"Ascending":false,
},
"TimeoutInSeconds":10
}
The JSON post I am sending looks like this:
{
"Query": {
"AuthID": "",
"ItemType": "",
"ParentID": "xxxxxxxxxxxx",
"CreatorID": "",
"LuceneQuery": "",
"SearchQuery": "filename ='foo.png'",
"CreateStartDate": "4/2/2014",
"CreateEndDate": "4/4/2014",
"ItemNameOnly": ""
},
"Paging": {
"Key": "",
"PageNumber": 1,
"PageSize": 10
},
"Sort": {
"SortBy": "",
"Ascending": false
},
"TimeoutInSeconds": 10
}
They prefilled some properties in their example post so I replicated. I did also try sending only what I needed too (instead of the blank properties) but still get a 500.
I can upload files, delete, modify, etc all fine with no issues so I am certain it is something in this JSON structure. I think it comes down to the "SearchQuery" property. There is zero examples on their documentation site, and any libraries that were made 3rd party only show a "query" parameter being passed in with no example of what that looks like...
Try This:
{
"Query": {
"AuthID": "",
"ItemType": "",
"ParentID": "xxxxxxxxxxxx",
"CreatorID": "",
"LuceneQuery": "",
"SearchQuery": "foo.png",
"CreateStartDate": "4/2/2014",
"CreateEndDate": "4/4/2014",
"ItemNameOnly": ""
},
"Paging": {
"Key": "",
"PageNumber": 1,
"PageSize": 10
},
"Sort": {
"SortBy": "",
"Ascending": false
},
"TimeoutInSeconds": 10
}
In searchQuery we have to specify item name itself instead of filename='itemname'. Working for me :)
I've been trying to wrestle with this too. I am using the HTTPS API and not the REST API, but maybe the same argument will work? My client has specified PHP so looking at Sharefile's PHP sample code sharefile.php - you will see a search function with a "$query" parameter. After a few attempts I tried supplying this argument: '{Name="Agreements"}'. I think you might be able to generalize to more complicated searches. The PHP sample code does a http_build_query to convert the above to the usual HTML parameter string.