참고: 프로젝트의 Latenode 체인에 새 노드를 추가한 후 이전 노드의 데이터에 액세스하려면 프로젝트를 실행하고 필요한 모든 데이터로 체인을 호출해야 합니다. "JavaScript" 노드에서 "HTTP 요청" 노드로 치환된 데이터는 큰따옴표로 이스케이프 처리해야 하는 경우가 많습니다. 원격 서버의 요청에 대한 응답으로 수신되어 문자열로 오는 복잡한 객체나 배열은 해당 데이터 유형과 마찬가지로 "JavaScript" 노드에서 작업하기 위해 JSON.parse에서 처리해야 합니다.
First, let's make sure to get the token according to the instructions in our article, only in the list choose "Google Sheets API v..." scope "www.googleapis.com/auth/spreadsheets" and "www.googleapis.com/auth/drive";
Create a new table, you can for example call it "LatenodeTestSheet4Add", with two columns "ID" and "Name";
앞의 단계에서 얻은 토큰으로 대체해 보겠습니다;
"웹훅" 노드를 만듭니다: "+ 노드 추가" => "Http" => "웹훅";
웹훅 주소를 복사하여 나머지 클라이언트 주소창에 붙여넣습니다;
Next, add another "JavaScript" node: "+ Add Node" => "Code" => "JavaScript";
저장;
노드를 서로 연결합니다;
체인을 시작하고 호출하여 노드 간에 데이터를 전송해 보겠습니다;
내용을 복사해 보겠습니다:
Let's check in all constructions like "data["{{1.body.name}}"]" that the number of Webhook corresponds to the one we are getting data from, if not replace it with the necessary one (let me remind you that 1 is the node number written just below the node name above the node type, then if it is a query then the object field responsible for the type of sent/received data is selected - body for forms or query for query parameters);
변경 사항을 저장합니다;
Create the "HTTP request" node to get the id of the table file: "+ Add node" => "Http" => "HTTP request";
저장;
노드를 서로 연결합니다;
체인을 시작하고 호출하여 노드 간에 데이터를 전송해 보겠습니다;
Let's form the "Url" field: at the beginning let's substitute the variable "apiDriveURI" from "JavaScript", after it we specify ?:q=name "variable tableFileName from "JavaScript"";
기본 메서드가 "가져오기"인지 확인합니다;
Let's add the "Autorization" header and the "bToken" variable from "JavaScript" to its value;
"저장"을 클릭합니다;
Create the "HTTP request" node to add data: "+ Add node" => "Http" => "HTTP request";
저장;
노드를 서로 연결합니다;
체인을 시작하고 호출하여 노드 간에 데이터를 전송해 보겠습니다;
Let's form the "Url" field: at the beginning let's substitute the variable "apiSheetURI" from "JavaScript", after it /spreadsheets/, after that substitute the value we got in the previous node {{ 3.body.files[ 0 ].id}}, and at the end /values/A:B:append?valueInputOption=USER_ENTERED&insertDataOption=INSERT_ROWS&includeValuesInResponse=true;
방법을 '게시' 방법으로 변경합니다;
In the body of "raw" let's substitute:
Let's add the "Autorization" header and the "bToken" variable from the first "JavaScript" node to its value;
Let's also add a "Content-Type" header with the value "application/json";
"저장"을 클릭합니다;
체인을 시작하고 호출하여 노드 간에 데이터를 전송해 보겠습니다;
Check our table, there should be a new entry;
Latenode 의 전체 체인 끝에는 다음과 같이 표시됩니다:
See you in new articles
Latenode
Google OAuth 2.0 플레이그라운드