Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function main() {
- let shema = {
- "$schema": "http://json-schema.org/draft-04/schema#",
- type: "object",
- properties: {
- folders: {
- type: "array",
- items: {
- type: "string",
- minLength: 1
- },
- minItems: 1,
- uniqueItems: true
- },
- actions: {
- type: "array",
- items: {
- type: "object",
- properties: {
- type: {
- type: "string",
- pattern: "^document|spreadsheet|presentation|image|video|script$"
- },
- name: {
- type: "string",
- minLength: 1
- },
- action: {
- oneOf: [
- {
- type: "object",
- properties: {
- type: {
- type: "string",
- pattern: "^delete$"
- }
- },
- additionalProperties: false,
- required: ["type"]
- },
- {
- type: "object",
- properties: {
- type: {
- type: "string",
- pattern: "^move$"
- },
- target: {
- type: "string",
- minLength: 1
- }
- },
- additionalProperties: false,
- required: ["type", "target"]
- },
- ]
- }
- },
- additionalProperties: false,
- required: ["name", "action"]
- },
- minItems: 1,
- uniqueItems: true
- },
- },
- additionalProperties: false,
- required: ["actions"]
- }
- let json = {
- folders: ["a"],
- actions: [
- {
- type: "document",
- name: "x",
- action: {
- type: "delete",
- }
- }
- ],
- }
- let data = {
- schema: shema,
- json: json
- }
- var options = {
- method: "post",
- contentType: "application/json",
- muteHttpExceptions: true,
- payload: JSON.stringify(data)
- };
- let responce = UrlFetchApp.fetch("https://assertible.com/json", options);
- console.log(`Responce code: ${responce.getResponseCode()}`);
- console.log(`Content: ${responce.getContentText()}`);
- }
Add Comment
Please, Sign In to add comment