When I drag a folder to another location,
is there any way I could know this activity, telling me that it is from where to where?
Use Google Drive Activity API to get informations about the changes made within a user's Google Drive.
Using activity.query():
Set the itemName based on the file/folder that you want to check activity using this format "items/FILE_ID" or "items/FOLDER_ID"
Set filter to detail.action_detail_case:MOVE to get move action activities
References:
Making Requests in the Drive Activity API
Filtering
Sample Request Body:
{
"filter": "detail.action_detail_case:MOVE",
"itemName": "items/1BNPRFAJgVMW-DF_sdEsF-_14X0xxxxx"
}
Filter all drive activity that has move ActionDetail
Primary criteria is to return activities for a specific folder with folder id: 1BNPRFAJgVMW-DF_sdEsF-_14X0xxxxx
Response Body:
This will return a DriveActivity object that will contain a Move object under ActionDetail object. You can refer to the removedParents->driveItem to get the information regarding the previous parent folder of the file/folder and addedParents->driveItem to get the new parent folder of the file/folder
{
"activities": [
{
"primaryActionDetail": {
"move": {
"addedParents": [
{
"driveItem": {
"name": "items/1mF5a3gxiLzVIRe2dhY4W3Alfxxxx",
"title": "NewFolder_Name",
"folder": {
"type": "STANDARD_FOLDER"
},
"driveFolder": {
"type": "STANDARD_FOLDER"
}
}
}
],
"removedParents": [
{
"driveItem": {
"name": "items/1lFzVvlBnBi-2o1VQGF5JDFRxxxxx",
"title": "TESTFOLDER",
"folder": {
"type": "STANDARD_FOLDER"
},
"driveFolder": {
"type": "STANDARD_FOLDER"
}
}
}
]
}
},
.....
"targets": [
{
"driveItem": {
"name": "items/11TrX6KcAJppWCj9GSUjSYn79Aqxxxx",
"title": "CSVFOLDER",
"folder": {
"type": "STANDARD_FOLDER"
},
"mimeType": "application/vnd.google-apps.folder",
.......
}
}
],
"timestamp": "2021-08-12T16:10:24.744Z"
}
]
}
Related
I am trying to use the PATCH projects/:project_id/items/:item_id endpoint in order to update the "displayName" attribute of an item in BIM360. There is an example on how to do exactly that in the Forge documentation, but for some reason I am getting an 400 error.
Here is my payload:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"attributes": {
"displayName": "NEW_ITEM_NAME.EXTENSION"
}
}
}
Here is the error I get:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "a4c43bbb-9e34-4973-9f9c-58a7e1d7bdb6",
"status": "400",
"code": "BAD_INPUT",
"title": "One or more input values in the request were bad",
"detail": "Request input is invalid for this operation."
}
]
}
I successfully use the same endpoint in order to change the parent folder for this same item (as described in this post answer: Autodesk Forge; Pragmatically changing file location without new upload ), so the problem must be in the update "displayName" portion. Here the successful payload sample that returns a 200 answer:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"relationships": {
"parent": {
"data": {
"type": "folders",
"id": "DESTINATION_FOLDER_URN"
}
}
}
}
}
Forge Documentation with example: https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-PATCH/
What am I missing in order to update the "displayName" attribute?
If you want to change the file name, you can change tip version name and title , creating new version is required, but you don't have to upload file again. Please try the API at https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-POST/ :
POST /versions?copyFrom={tip_version_urn}
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "versions",
"attributes": {
"name": "newName"
}
}
}
A new tip version will be created with the updated name.
API Request
POST https://www.google.com/m8/feeds/contacts/default/full?alt=json
Body
{
"entry": {
"gd$name": {
"gd$fullName": {
"$t": "Rohit Roy"
},
"gd$givenName": {
"$t": "Rohit"
},
"gd$familyName": {
"$t": "Roy"
}
},
"gd$email": [
{
"address": "royrohit1234#exampledomain.com",
"primary": "true",
"rel": "http://schemas.google.com/g/2005#home"
}
],
"gd$phoneNumber": {
"$t": "+919999888877",
"primary": "true",
"rel": "http://schemas.google.com/g/2005#home"
},
"gd$organization": {
"gd$orgName": {
"$t": "XYZ Pvt. ltd."
}
}
}
}
This code is working properly i want to add custom fields to google contacts.
For that i tried convert below XML into JSON.
<gContact:userDefinedField key="chess" value="likes playing black"/>
Like This
"gContact$userDefinedField":{
"key":"food",
"value":"Chinese"
}
But this code is not working with above code so i need help to add custom field with my working code above.
Fortunately i got solution of custom fields, birthday and all other google contact fields with JSON API.
Google Contact API Docs updated and mentioned about Peoples API which is replacement of old google contact API.
So now i am using Peoples API instead of Contacts API V3 which already deprecated.
Click This Link For Peoples API Create Contact API Docs
HTTP Request
POST https://people.googleapis.com/v1/people:createContact
Body
{
"emailAddresses": [
{
"value": "rohitroy#exampledomain.com",
"type": "work"
}
],
"names": [{
"givenName": "John",
"familyName": "Doe"
}],
"birthdays": [
{
"date": {
"year": 1996,
"month": 5,
"day": 2
}
}
],
"userDefined": [
{
"key": "customfield",
"value": "anyvalue-123456"
}
]
}
In the Body userDefined is for custom fields.
I'm trying to create multiple documents at once in a Firestore collection with configuration purposes. I can create documents one by one sending from Postman:
{
"fields": {
"category":{"stringValue": "Configs"},
"order":{"integerValue":"3"}
}
}
I was wondering if there is some way to create multiple documents sending something like this:
{
"batch": [
{
"fields": {
"categoria": {
"stringValue": "Configurações"
},
"ordem": {
"integerValue": "3"
}
}
},
{
"fields": {
"categoria": {
"stringValue": "Configurações"
},
"ordem": {
"integerValue": "3"
}
}
}
]
}
Can anyone say if is it possible? If so, how can I do that?
Something like the below should work.
Although it is an "update" action is creates new documents as well if they don't exist. The document ID must be provided, it cannot be auto generated using the commit endpoint.
I was able to get my use case to work after viewing this response detailing use of commit.
API Endpoint: https://firestore.googleapis.com/v1/projects/projectID/databases/(default)/documents:commit
{
"writes": [
{
"update": {
"name": "projects/projectID/databases/(default)/documents/test/ExistingDocumentID1",
"fields": {
"comment": {
"stringValue": "Hello World!"
}
}
}
},
{
"update": {
"name": "projects/projectID/databases/(default)/documents/test/NewManualDocumentID2",
"fields": {
"comment": {
"stringValue": "Happy Birthday!"
}
}
}
}
]
}
I am getting my feet wet in VueJS/Gridsome and I am trying to make a simple site to start off. What I am looking to do is store all my data locally in a JSON file and pull it into my page/component using GraphQL. I am able to see the data load however I cannot iterate through every object; instead it shows me all the data.
I have tried changing the way I layout my JSON objects schemas, tried separating into multiple json files (Do not want to do this) and have played with different v-for parameters. On the Gridsome Docs and Youtube Tutorials everyone is pulling from markdown and generating pages from each markdown file or using some sort of API. I want to accomplish this in a single JSON file.
videos.json
[
{
"title": "vid 1",
"url": "url1"
},
{
"title": "vid 2",
"url": "url2"
}
]
GraphQL Query
{
allVideo {
edges {
node{
id
data {
title
url
}
}
}
}
}
GraphQL Results
{
"data": {
"allVideo": {
"edges": [
{
"node": {
"id": "6b3cddf43cce8f8a0fb122d194db6edc",
"data": [
{
"title": "vid 1",
"url": "https://youtube.com"
},
{
"title": "vid 2",
"url": "https://youtube.com"
}
]
}
}
]
}
}
}
Videos.vue
<template>
<Layout>
<h1>Videos</h1>
<div v-for="edge in $page.allVideo.edges" :key="edge.node.id">
{{edge.node.data}}
</div>
</Layout>
</template>
<page-query>
query Videos {
allVideo {
edges {
node {
id
data {
title
url
}
}
}
}
}
</page-query>
Page Result:
Videos
[ { "title": "vid 1", "url": "url1" }, { "title": "vid 2", "url": "url2" } ]
I expect there to be an ID for each video entry, however it seems that the data collection is in the wrong scope and I cannot get it one level up to be with ID to generate an ID with each set of video.
I am looking for something that will give me this query result:
{
"data": {
"allVideo": {
"edges": [
{
"node": {
"id": "6b3cddf43cce8f8a0fb122d194db6edc",
"data": [
{
"title": "vid 1",
"url": "url1"
}
]
}
},
{
"node": {
"id": "some other ID",
"data": [
{
"title": "vid 2",
"url": "url 2"
}
]
}
}
]
}
}
}
You can do this by querying a single video using the GraphQL query below.
If you check the docs on GraphQL playground on http://localhost:8081/___explore you should see a query for Video and also allVideo. Instead of using allVideo in your vue components use a single video and pass in the ID you should get the result you want.
{
Video(id: "6b3cddf43cce8f8a0fb122d194db6edc") {
edges {
node{
id
data {
title
url
}
}
}
}
}
I'm prototyping a web service to convert data using Design Automation API in Autodesk Forge.
My approach is to invoke an activity that executes a script to import a target data file (such as STEP, IGES format).
As an example, I created an activity to convert a STEP file to DWG as follows:
{
"HostApplication": "",
"RequiredEngineVersion": "22.0",
"Parameters": {
"InputParameters": [{
"Name": "Source",
"LocalFileName": "input.stp"
}, {
"Name": "HostDwg",
"LocalFileName": "$(HostDwg)"
}],
"OutputParameters": [{
"Name": "Result",
"LocalFileName": "output.dwg"
}]
},
"Instruction": {
"CommandLineParameters": null,
"Script": "import\ninput.stp\nsaveas\n\noutput.dwg\n"
},
"Version": 1,
"Id": "Step2Dwg"
}
The workitem to invoke this activity was executed without errors, but the output file (output.dwg) had nothing imported from the input file (input.stp).
Perhaps this is because some fields (e.g., AllowedChildProcess) were missing in the definition of the activity "Step2Dwg", but I do not know how to fix it.
My questions are:
How to fix the definition of the activity "Step2Dwg" to convert data successfully?
Is there any other approach to create an activity to convert data successfully?
You can use the Activity “Translate-STEP2DWG". It takes a .stp file as input and generate result.dwg as output. This is a public activity that anybody can send workitems against to it.
The activity is defined like this:
{
"Id": "Translate-STEP2DWG",
"AppPackages": [],
"HostApplication": "AcTranslators.exe",
"RequiredEngineVersion": "22.0",
"Parameters": {
"InputParameters": [
{
"Name": "HostDwg",
"LocalFileName": "source.stp"
}
],
"OutputParameters": [
{
"Name": "Result",
"LocalFileName": "result.dwg"
}
]
},
"Instruction": {
"CommandLineParameters": "-i source.stp -o result.dwg",
"Script": ""
},
"AllowedChildProcesses": [
],
"IsPublic": true,
"Version": 1,
"Description": ""
}
Here is a sample workitem request body:
{
"ActivityId": "Translate-STEP2DWG",
"Arguments": {
"InputArguments": [
{
"Resource": "https://s3.amazonaws.com/AutoCAD-Core-Engine-Services/TestDwg/3DStep.stp",
"Name": "HostDwg"
}
],
"OutputArguments": [
{
"Name": "Result",
"HttpVerb": "POST"
}
]
}
}