{"id":28273079,"url":"https://github.com/zesty-io/zestyio-node-api-wrapper","last_synced_at":"2026-07-02T10:32:00.592Z","repository":{"id":57405688,"uuid":"151464575","full_name":"zesty-io/zestyio-node-api-wrapper","owner":"zesty-io","description":"An API Wrapper to easily access Zesty.io's Rest API with NodeJS","archived":false,"fork":false,"pushed_at":"2020-06-01T15:21:47.000Z","size":132,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-13T13:26:40.275Z","etag":null,"topics":["api","api-wrapper","nodejs","zestyio"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/zestyio-api-wrapper","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zesty-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-03T18:58:14.000Z","updated_at":"2020-06-01T15:21:49.000Z","dependencies_parsed_at":"2022-09-26T17:01:45.409Z","dependency_job_id":null,"html_url":"https://github.com/zesty-io/zestyio-node-api-wrapper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zesty-io/zestyio-node-api-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zesty-io%2Fzestyio-node-api-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zesty-io%2Fzestyio-node-api-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zesty-io%2Fzestyio-node-api-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zesty-io%2Fzestyio-node-api-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zesty-io","download_url":"https://codeload.github.com/zesty-io/zestyio-node-api-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zesty-io%2Fzestyio-node-api-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35043933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-wrapper","nodejs","zestyio"],"created_at":"2025-05-21T00:17:16.597Z","updated_at":"2026-07-02T10:32:00.576Z","avatar_url":"https://github.com/zesty-io.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zesty.io Node API Wrapper\n\n| Deprecation Notice - Posted March 14th 2020 |\n| ------------ |\n| **Updates and support to the zesty node api wrapper will continue until June, 1st 2021** |\n| The zesty node api wrapper package will remain available through NPM with a decrecation warning. |\n| **Please migrate your scripts and services the Zesty.io Node SDK** https://www.npmjs.com/package/@zesty-io/sdk |\n| Thank you, Reach out to support at zesty dot io with any questions. |\n\n\nQuickly access Zesty.io's Instance, Accounts and Media Management APIs.\n\n## Installation\n\nThis tutorial assumes you have npm and Node.js (8.9.4 or greater) installed, and have a `package.json` file for your project.\n\nInstall via npm:\n\n```\nnpm install zestyio-api-wrapper\n```\n\nInclude this line at the top of your JavaScript project file:\n\n```javascript\nconst Zesty = require(\"zestyio-api-wrapper\");\n```\n\n## Instantiation\n\nYou can get the Zesty.io token and instance ZUID for your instance from the Zesty.io manager, or by using the authentication functionality in the wrapper. At this time, authentication through the wrapper does not support user accounts using 2FA authentication.\n\n### Authenticating using the Wrapper\n\nThis wrapper now includes functionality to authenticate a user by their email address and password, returning a token that can then be used to make API calls. This should be used, for scenarios such as building a tool that runs periodically and authenticates to Zesty.io in order to perform some task: uploading content or retrieving audit log information for example.\n\nWe do not recommend that you put values for email address and password in your code or source control system - treat these as secrets and use environment variables or some other mechanism to ensure that their values aren't stored in the code nor committed to source control.\n\nIn the following example, we're assuming the use of environment variables:\n\n```javascript\nconst ZestyAuth = require(\"zestyio-api-wrapper/auth\");\n\ntry {\n  const email = process.env.ZESTY_USER_EMAIL;\n  const password = process.env.ZESTY_USER_PASSWORD;\n\n  const zestyAuth = new ZestyAuth();\n\n  const token = await zestyAuth.login(email, password);\n} catch (e) {\n  console.log(e);\n}\n```\n\nIf the correct credentials are configured in the environment variables `ZESTY_USER_EMAIL` and `ZESTY_USER_PASSWORD`, the above snippet will log the user in and return a token that can then be used to instantiate the API wrapper.\n\n### Obtaining a Token Manually from the Zesty Editor\n\nYou can also obtain a token manually by logging into your Zesty.io instance, then going to the \"Editor\" section in the manager application. From there, click on the \"External Editing\" button which displays the ZUID and token for your instance.\n\n### Instantiating the Wrapper\n\nOnce you have obtained a token, you can instantiate the API wrapper as follows:\n\n```javascript\nconst token = \"PRIVATE_TOKEN_FROM_ZESTYIO\"; // Obtain using one of the methods described above\nconst instanceZUID = \"8-...\"; // ZUID of the Zesty.io Cloud Content Instance on which to make requests\n\nconst zesty = new Zesty(instanceZUID, token);\n```\n\nYou can optionally enable API request and error logging by setting one or both of the `logErrors` and `logResponses` flags:\n\n```javascript\nconst zesty = new Zesty(instanceZUID, token, {\n  logErrors: true,\n  logResponses: true\n});\n```\n\nNote that the user whose login generated the token will need to have permissions to access the particular Zesty.io instance that the wrapper is instantiated with. As access to instances is also associated with roles, the user will need to have the appropriate role set in Zesty.io in order to be allowed to perform various API calls.\n\n### Validating a Token\n\nTokens are currently session based. This means that they will expire after a period of inactivity. To check whether a token is valid you can use the `verifyToken` method in the auth class:\n\n```javascript\ntry {\n  const zestyAuth = new ZestyAuth();\n\n  // token has been obtained from zestyAuth.login...\n\n  const isTokenGood = await zestyAuth.verifyToken(token);\n} catch (e) {\n  console.log(e);\n}\n```\n\nIf this returns `true`, your token is good to make API calls. If `false`, you should re-authenticate and get a new token.\n\n## Usage\n\n### Response Object Format\n\nResponses from the API will generally be delivered as objects having the following form:\n\n```javascript\n{\n  _meta: {\n    timestamp: '2019-02-14T18:42:19.279094718Z',\n    totalResults: 1,\n    start: 0,\n    offset: 0,\n    limit: 1\n  },\n  data: // Object or array of objects.\n}\n```\n\nThe content of `data` will be either an object (for endpoints that return one item) or an array containing zero or more objects (endpoints that can return multiple items will return an array regardless of how many items match the query).\n\n### Error Response Format\n\nResponses for error cases will generally be delivered as objects having the following form:\n\n```javascript\n{\n  reason: 'Textual description',\n  statusCode: 401, // HTTP response code from API, 400, 401, 500 etc\n  error: 'Something is wrong' // null or string or object with error detail\n}\n```\n\n### Content Models and Fields\n\nRetrieval of content models and model fields. See documentation:\n\n- [Content Models](https://instances-api.zesty.org/#5f8c1a85-1775-f67b-c5e0-a061f69e7ddb)\n- [Fields](https://instances-api.zesty.org/#689c935d-a46c-8eef-cf20-df60f55c38d3)\n\n**Get all content models:**\n\n```javascript\ntry {\n  const res = await zesty.getModels();\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a content model by ZUID:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\"; // Model ZUIDs begin with 6\n  const res = await zesty.getModel(modelZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get all fields for a content model:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const res = await zesty.getFields(modelZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a specific field by field ZUID for a content model:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const fieldZUID = \"12-...\"; // Field ZUIDs begin 12\n  const res = await zesty.getField(modelZUID, fieldZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Content Items\n\nContent items are always accessed relative to their model, so a model ZUID is required for each call. See the documentation [here](https://instances-api.zesty.org/#74adb209-9eea-0561-e98b-75a2a1b9882b).\n\n**Get all content items for a model:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\"; // Model ZUIDs begin with 6\n  const res = await zesty.getItems(modelZUID);\n  console.log(res);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a specific content item by ZUID:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\"; // Item ZUIDs begin with 7\n  const res = await zesty.getItem(modelZUID, itemZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Create a content item:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const res = await zesty.createItem(modelZUID, {\n    data: {\n      // Values here will depent on content model\n      text_field_one: \"hello\",\n      text_field_two: \"world\"\n    },\n    meta: {\n      createdByUserZUID: \"5-...\", // User ZUIDs begin with 5\n      contentModelZUID: modelZUID\n    },\n    web: {\n      canonicalTagMode: 1,\n      metaDescription: \"This is the description.\",\n      metaKeywords: \"these,are,some,keywords\",\n      metaLinkText: \"This is the meta link text.\",\n      metaTitle: \"This is the meta title.\"\n    }\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\nThis will return the ZUID of the created item in the response.\n\n**Save a content item:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\";\n\n  const res = await zesty.saveItem(modelZUID, itemZUID, {\n    data: {\n      text_field_one: \"updated\",\n      text_field_two: \"item\"\n    },\n    meta: {\n      masterZUID: itemZUID\n    }\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get all versions for a specific content item by ZUID:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\";\n  const res = await zesty.getItemVersions(modelZUID, itemZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a specific version of a content item by version ZUID:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\";\n  const res = await zesty.getItemVersion(modelZUID, itemZUID, 2);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Delete a content item by ZUID:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\";\n  const res = await zesty.deleteItem(modelZUID, itemZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\nExample response:\n\n```javascript\n{ _meta:\n   { timestamp: '2019-02-20T23:25:37.556Z',\n     totalResults: 1,\n     start: 0,\n     offset: 0,\n     limit: 1 },\n  message: 'Item deleted',\n  data: {}\n}\n```\n\n\u003e **Note:** this response format may change in future.\n\n### Item Publishing and Unpublishing\n\n**Publish a version of an item immediately:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\";\n  const versionNumber = 1;\n  const res = await zesty.publishItemImmediately(\n    modelZUID,\n    itemZUID,\n    versionNumber\n  );\n} catch (err) {\n  console.log(err);\n}\n```\n\nThe expected response looks like this:\n\n```javascript\n{\n  _meta: {\n    timestamp: '2019-02-20T23:28:25.487Z',\n    totalResults: 1,\n    start: 0,\n    offset: 0,\n    limit: 1\n  },\n  message: 'Published',\n  data: {\n    item_zuid: '7-...',\n    version_zuid: '9-...',\n    version_num: '1'\n  }\n}\n```\n\n\u003e **Note:** this response format may change in future.\n\n**Unpublish a published item immediately:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\";\n  const publishingZUID = \"18-...\";\n  const res = await zesty.unpublishItemImmediately(\n    modelZUID,\n    itemZUID,\n    publishingZUID\n  );\n} catch (err) {\n  console.log(err);\n}\n```\n\nThe expected response looks like this:\n\n```javascript\n{\n  _meta: {\n    timestamp: '2019-02-20T23:46:14.423Z',\n    totalResults: 1,\n    start: 0,\n    offset: 0,\n    limit: 1\n  },\n  message: 'Entry updated',\n  data: {}\n}\n```\n\n\u003e **Note:** this response format may change in future.\n\n**Get all publishing records for a specific content item by ZUID:**\n\n```javascript\ntry {\n  const modelZUID = \"6-...\";\n  const itemZUID = \"7-...\";\n  const res = await zesty.getItemPublishings(modelZUID, itemZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get specific publishing record by publishing ZUID for a content item:**\n\n```javascript\ntry {\n  const modelZUID = \"6-3029e8-x4cbhh\";\n  const itemZUID = \"7-9cd6d2cdf9-spmszq\";\n  const publishingZUID = \"18-7c02d25-rpzw1v\"; // Publishing ZUIDs begin with 18\n  const res = await zesty.getItemPublishing(\n    modelZUID,\n    itemZUID,\n    publishingZUID\n  );\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Views\n\nThe wrapper allows CRUD on Zesty.io view files. See documentation [here](https://instances-api.zesty.org/#efc2e79a-e392-4114-a722-c3b512e23833):\n\n**Get all views:**\n\n(returns an array of view objects)\n\n```javascript\ntry {\n  const res = await zesty.getViews();\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a view by ZUID:**\n\n```javascript\ntry {\n  const viewZUID = \"11=...\"; // View ZUIDS begin with 11\n  const res = await zesty.getView(viewZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Create a view (snippet):**\n\n```javascript\nconst fileName = \"navigation-snippet\";\nconst code = \"my view content\";\nconst payload = {\n  code: code,\n  fileName: fileName\n};\n\ntry {\n  const res = await zesty.createView(payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Create a view (endpoint):**\n\n```javascript\nconst fileName = \"/special-endpoint.json\";\nconst code = JSON.stringify({ foo: \"bar\" });\nconst payload = {\n  code: code,\n  type: \"ajax-json\",\n  fileName: fileName\n};\n\ntry {\n  const res = await zesty.createView(payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save a view:**\n\nThis will only save the updated view, and will not publish it.\n\n```javascript\nconst viewZUID = \"11-...\";\nconst code = \"my view content\";\nconst payload = {\n  code: code\n};\n\ntry {\n  const res = await zesty.saveView(viewZUID, payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save and publish a view:**\n\nBoth saves the updated view and publishes it.\n\n```javascript\nconst viewZUID = \"11-...\";\nconst code = \"my view content\";\nconst payload = {\n  code: code\n};\n\ntry {\n  const res = await zesty.saveAndPublishView(viewZUID, payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get all versions of a view:**\n\n```javascript\nconst viewZUID = \"11-...\";\n\ntry {\n  const res = await zesty.getViewVersions(viewZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a specific version of a view:**\n\n```javascript\nconst viewZUID = \"11-...\";\nconst viewVersionNumber = 2;\n\ntry {\n  const res = await zesty.getViewVersion(viewZUID, viewVersionNumber);\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Scripts\n\nCRUD on Zesty.io script files. See documentation [here](https://instances-api.zesty.org/#83f109ba-94a8-4647-8cb7-06f2bfe291a0).\n\n**Get all scripts:**\n\n(returns an array of script objects).\n\n```javascript\ntry {\n  const res = await zesty.getScripts();\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a script by ZUID:**\n\n```javascript\ntry {\n  const scriptZUID = \"10-...\"; // Script ZUIDs begin with 10\n  const res = await zesty.getScript(scriptZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Create a script:**\n\n```javascript\nconst fileName = \"my-script.js\";\nconst code = \"alert('hello world');\";\nconst payload = {\n  code: code,\n  fileName: fileName,\n  type: \"text/javascript\"\n};\n\ntry {\n  const res = await zesty.createScript(payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save a script:**\n\nChange the contents of a script, while retaining the filename.\n\n```javascript\nconst scriptZUID = \"10-...\";\nconst code = \"alert('hello world');\";\nconst payload = {\n  code: code\n};\n\ntry {\n  const res = await zesty.saveScript(scriptZUID, payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save and publish a script:**\n\nBoth saves the updated script and publishes it.\n\n```javascript\nconst scriptZUID = \"10-...\";\nconst code = \"alert('hello again');\";\nconst payload = {\n  code: code\n};\n\ntry {\n  const res = await zesty.saveAndPublishScript(scriptZUID, payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get all versions of a script:**\n\n```javascript\ntry {\n  const scriptZUID = \"10-...\";\n  const res = await zesty.getScriptVersions(scriptZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a specific version of a script:**\n\n```javascript\ntry {\n  const scriptZUID = \"10-...\";\n  const versionNumber = 1;\n  const res = await zesty.getScriptVersion(scriptZUID, versionNumber);\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Stylesheets\n\nCRUD on Zesty.io stylesheet files. See documentation [here](https://instances-api.zesty.org/#f72b36b1-43cd-46cd-aae0-2e98cd9bbdda).\n\n**Get all stylesheets:**\n\n```javascript\ntry {\n  const res = await zesty.getStylesheets();\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a stylesheet by ZUID:**\n\n```javascript\ntry {\n  const stylesheetZUID = \"10-...\"; // Stylesheet ZUIDs begin with 10\n  const res = await zesty.getStylesheet(stylesheetZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Create a stylesheet:**\n\n```javascript\nconst fileName = \"styles.less\";\nconst code = \".myClass { text-align: left; }\";\nconst stylesheetType = \"text/less\"; // Can also use text/css or text/scss\nconst payload = {\n  code: code,\n  fileName: fileName,\n  type: stylesheetType\n};\n\ntry {\n  const res = await zesty.createStylesheet(payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Create a stylesheet and show transpiler errors:**\n\n```javascript\nconst fileName = \"styles.less\";\nconst code = \".myClass { text-align: left; }\";\nconst stylesheetType = \"text/less\"; // Can also use text/css or text/scss\nconst payload = {\n  code: code,\n  fileName: fileName,\n  type: stylesheetType\n};\nconst showError = true;\n\ntry {\n  const res = await zesty.createStylesheet(payload, showError);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save a stylesheet:**\n\nChange the contents of a stylesheet, while retaining the filename and file type.\n\n```javascript\nconst stylesheetZUID = \"10-...\";\nconst code = \".anotherClass { text-align: center; }\";\n\nconst payload = {\n  code: code\n};\n\ntry {\n  const res = await zesty.saveStylesheet(stylesheetZUID, payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save a stylesheet and show transpiler errors:**\n\nChange the contents of a stylesheet, while retaining the filename and file type.\n\n```javascript\nconst stylesheetZUID = \"10-...\";\nconst code = \".anotherClass { text-align: center; }\";\n\nconst payload = {\n  code: code\n};\nconst showError = true;\n\ntry {\n  const res = await zesty.saveStylesheet(stylesheetZUID, payload, showError);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save and publish a stylesheet:**\n\nBoth saves the updated stylesheet and publishes it.\n\n```javascript\nconst stylesheetZUID = \"10-...\";\nconst code = \".anotherClass { background-color: #ff0000; }\";\nconst payload = {\n  code: code\n};\n\ntry {\n  const res = await zesty.saveAndPublishStylesheet(stylesheetZUID, payload);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Save and publish a stylesheet and show transpiler errors:**\n\nBoth saves the updated stylesheet and publishes it.\n\n```javascript\nconst stylesheetZUID = \"10-...\";\nconst code = \".anotherClass { background-color: #ff0000; }\";\nconst payload = {\n  code: code\n};\nconst showError = true;\n\ntry {\n  const res = await zesty.saveAndPublishStylesheet(stylesheetZUID, payload, showError);\n} catch (err) {\n  console.log(err);\n}\n```\n\n\n**Get all versions of a stylesheet:**\n\n```javascript\ntry {\n  const stylesheetZUID = \"10-...\";\n  const res = await zesty.getStylesheetVersions(stylesheetZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a specific version of a stylesheet:**\n\n```javascript\ntry {\n  const stylesheetZUID = \"10-...\";\n  const stylesheetVersion = 1;\n  const res = await zesty.getStylesheetVersion(\n    stylesheetZUID,\n    stylesheetVersion\n  );\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Head Tags\n\nCRUD on `\u003chead\u003e` tags (for example meta tags, stylesheet `link` tags, `script` tags that go in the head area of an HTML document). Allows setting of tags at a per item (refered to as Resource ZUID in the documentation) level. See documentation [here](https://instances-api.zesty.org/#1eabcc23-03a1-4414-bba1-177228345c8e).\n\n**Get all head tags:**\n\n```javascript\ntry {\n  const res = await zesty.getHeadTags();\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a single head tag by ZUID:**\n\n```javascript\nconst headTagZUID = `21-...`; // Head Tag ZUIDs begin with 21\n\ntry {\n  const res = await zesty.getHeadTag(headTagZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Create a head tag:**\n\nSee the [documentation](https://instances-api.zesty.org/#1eabcc23-03a1-4414-bba1-177228345c8e) for the full range of options.\n\n```javascript\nconst resourceZUID = \"7-...\"; // A content item\n\ntry {\n  // Create a script tag to load a script only when rendering the view for the\n  // content item whose ZUID is in resourceZUID\n\n  let res = await zesty.createHeadTag({\n    type: \"script\",\n    attributes: {\n      src: \"https://mydomain.com/libs/library.js\"\n    },\n    resourceZUID: resourceZUID\n  });\n\n  // Create a meta 'generator' tag added in the head only when rendering the\n  // view for the content item whose ZUID is in resourceZUID\n\n  res = await zesty.createHeadTag({\n    type: \"meta\",\n    attributes: {\n      generator: \"This is a test\"\n    },\n    resourceZUID: resourceZUID\n  });\n\n  // Create a 'link' tag to load a CSS file from a specified URL only when\n  // rendering the view for the content item whose ZUID is in resourceZUID.\n\n  res = await zesty.createHeadTag({\n    type: \"link\",\n    attributes: {\n      rel: \"stylesheet\",\n      href: \"https://mydomain.com/css/mystylesheet.css\"\n    },\n    resourceZUID: resourceZUID\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Update an existing head tag by ZUID:**\n\nSee the [documentation](https://instances-api.zesty.org/#1eabcc23-03a1-4414-bba1-177228345c8e) for the full range of options.\n\n```javascript\nconst headTagZUID = `21-...`; // Head Tag ZUIDs begin with 21\nconst resourceZUID = \"7-...\"; // A content item\n\n// Update an existing head tag to be a script loaded from its URL only\n// when rendering the view for the content item whose ZUID is in resourceZUID.\n\ntry {\n  const res = await zesty.saveHeadTag(headTagZuid, {\n    type: \"script\",\n    attributes: {\n      src: \"https://mydomain.com/libs/another-library.js\"\n    },\n    resourceZUID: resourceZUID\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Delete a single head tag by ZUID:**\n\n```javascript\nconst headTagZUID = `21-...`; // Head Tag ZUIDs begin with 21\n\ntry {\n  const res = await zesty.getSiteHead();\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Site Head Entries\n\n**Get all site head entries:**\n\nSee API documentation [here](https://instances-api.zesty.org/#1b097314-1e85-450f-86f7-186f1a3f080f).\n\n```javascript\ntry {\n  const res = await zesty.deleteHeadTag(headTagZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Navigation Entries\n\n**Get all navigation entries:**\n\nReturns all items needed to build navigation for a management interface. See the API documentation [here](https://instances-api.zesty.org/#b340777b-c900-4b5e-8455-82b9a10ac56a).\n\n```javascript\ntry {\n  const res = await zesty.getNav();\n} catch (err) {\n  console.log(err);\n}\n```\n\n### Audit Trail\n\nProvides methods to retrieve and filter audit trail entries. See documentation [here](https://instances-api.zesty.org/#026123c3-086e-42bd-9eda-86c2b5de33a2).\n\n**Get all audit trail entries:**\n\n```javascript\ntry {\n  const res = await zesty.getAuditTrailEntries();\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get a specific audit trail entry by ZUID:**\n\n```javascript\nconst auditZUID = \"15-...\"; // Audit trail entry ZUIDs begin with 15\n\ntry {\n  const res = await zesty.getAuditTrailEntries(auditZUID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get audit trail entries having specific properties:**\n\n```javascript\nconst filterProps = {\n  // Object keys can be:\n  // order\n  // dir\n  // start_date\n  // end_date\n  // limit\n  // page\n  // action\n  // affectedZUID\n  // userZUID\n  // See documentation for examples.\n};\n\ntry {\n  res = await zesty.searchAuditTrailEntries({\n    limit: 5,\n    order: \"created\",\n    dir: \"desc\"\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\nExamples for each filtering parameter can be found in the [API documentation](https://instances-api.zesty.org/#026123c3-086e-42bd-9eda-86c2b5de33a2).\n\n### Instance Settings\n\n**Get all instance settings:**\n\n```javascript\ntry {\n  const res = await zesty.getSettings();\n} catch (err) {\n  console.log(err);\n}\n```\n\n**Get instance setting by setting ID:**\n\n```javascript\ntry {\n  const settingID = 5;\n  const res = await zesty.getSetting(settingID);\n} catch (err) {\n  console.log(err);\n}\n```\n\n## Media Management Calls\n\n### Media Bins\n\n**Get all media bins:**\n\n```javascript\ntry {\n  const binsResponse = await zesty.getMediaBins();\n  const firstBin = binsResponse.data[0];\n  const firstBinId = firstBin.id;\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Bin',\n  status: 'OK',\n  code: 200,\n  data:[\n    {\n      id: '\u003cBin ZUID\u003e',\n      name: '\u003cBin Name\u003e',\n      created_at: '2018-07-09T21:50:27.000Z',\n      deleted_at: null,\n      default: true\n    },\n    ...\n  ]\n}\n```\n\n**Get media bin by ID:**\n\n```javascript\ntry {\n  const binId = \"media bin ID\";\n  const binResponse = await zesty.getMediaBin(binId);\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Bin',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cBin ZUID\u003e',\n      name: '\u003cBin Name\u003e',\n      created_at: '2018-07-09T21:50:27.000Z',\n      deleted_at: null\n    }\n  ]\n}\n```\n\n**Update media bin by ID:**\n\n(Allows for bin name to be updated).\n\n```javascript\nconst binId = \"media bin ID\";\n\ntry {\n  const binUpdateResponse = await zesty.updateMediaBin(binId, {\n    name: \"New Name\"\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Bin \u003cBin ZUID\u003e updated',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cBin ZUID\u003e',\n      name: 'New Name'\n    }\n  ]\n}\n```\n\n### Media Groups (Folders)\n\n**Get all media groups in a bin:**\n\n```javascript\nconst binId = \"media bin ID\";\n\ntry {\n  const binGroupsResponse = await zesty.getMediaGroups(binId);\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Folder',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cGroup ZUID\u003e',\n      bin_id: '\u003cBin ZUID\u003e',\n      group_id: '\u003cParent Group ZUID\u003e',\n      name: '\u003cGroup Name\u003e'\n    },\n    ...\n  ]\n}\n```\n\n**Get media group by ID:**\n\n```javascript\nconst groupId = \"media group ID\";\n\ntry {\n  const groupResponse = await zesty.getMediaGroup(groupId);\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'group',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cGroup ZUID\u003e',\n      bin_id: '\u003cBin ZUID\u003e',\n      group_id: '\u003cParent Group ZUID\u003e',\n      name: '\u003cGroup Name\u003e',\n      groups: [],\n      files: [\n        {\n          id: '\u003cFile ZUID\u003e',\n          bin_id: '\u003cBin ZUID\u003e',\n          group_id: '\u003cGroup ZUID\u003e',\n          filename: '\u003cFilename\u003e',\n          title: '\u003cFile Display Name\u003e',\n          url: '\u003cURL to file\u003e',\n          created_by: null,\n          created_at: '2018-10-22T23:13:24.000Z',\n          updated_at: '2018-10-22T23:13:40.000Z',\n          deleted_at: null\n        },\n        ...\n      ]\n    }\n  ]\n}\n```\n\n**Create media group:**\n\n```javascript\nconst binId = \"media bin ID\";\nconst groupId = \"parent group ID - optional\";\nconst name = \"new group name - optional defaults to new folder\";\n\ntry {\n  const createGroupResponse = await zesty.createMediaGroup({\n    bin_id: binId,\n    group_id: groupId,\n    name: name\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Created folder \u003cGroup Name\u003e',\n  status: 'OK',\n  code: 201,\n  data: [\n    {\n      id: '\u003cGroup ZUID\u003e',\n      bin_id: '\u003cBin ZUID\u003e',\n      group_id: '\u003cParent Group ZUID\u003e',\n      name: '\u003cGroup Name\u003e',\n      type: 'group'\n    }\n  ]\n}\n```\n\n**Update media group by ID:**\n\n```javascript\nconst groupId = \"group ID to update\";\nconst parentGroupId = \"parent group ID - optional\";\nconst name = \"new group name - optional\";\n\ntry {\n  const updateGroupResponse = await zesty.updateMediaGroup(groupId, {\n    group_id: parentGroupId,\n    name: name\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Updated group \u003cGroup Name\u003e',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cGroup ZUID\u003e',\n      name: '\u003cGroup Name\u003e',\n      group_id: '\u003cParent Group ZUID\u003e'\n     }\n  ]\n}\n```\n\n**Delete media group by ID:**\n\n```javascript\nconst groupId = \"group ID to delete\";\n\ntry {\n  const deleteGroupResponse = await zesty.deleteMediaGroup(groupId);\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Deleted group \u003cGroup ZUID\u003e',\n  status: 'OK',\n  code: 200\n}\n```\n\n### Media Files\n\n**Get all media files in a bin:**\n\n```javascript\nconst binId = \"media bin ID\";\n\ntry {\n  const binFilesResponse = await zesty.getMediaFiles(binId);\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Group',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cFile ZUID\u003e',\n      bin_id: '\u003cBin ZUID\u003e',\n      group_id: '\u003cGroup ZUID\u003e',\n      filename: '\u003cFile name\u003e',\n      title: '\u003cFile display name\u003e',\n      url: '\u003cURL to file\u003e',\n      created_by: null,\n      created_at: '2018-10-22T23:13:24.000Z',\n      updated_at: '2018-10-22T23:13:40.000Z',\n      deleted_at: null,\n    },\n    ...\n  ]\n}\n```\n\n**Get media file by ID:**\n\n```javascript\nconst fileId = \"media file ID\";\n\ntry {\n  const fileResponse = await zesty.getMediaFile(fileId);\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Files',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cFile ZUID\u003e',\n      bin_id: '\u003cBin ZUID\u003e',\n      group_id: '\u003cGroup ZUID\u003e',\n      filename: '\u003cFile name\u003e',\n      title: '\u003cFile display name\u003e',\n      url: '\u003cURL to file\u003e',\n      created_by: null,\n      created_at: '2018-10-22T23:13:24.000Z',\n      updated_at: '2018-10-22T23:13:40.000Z',\n      deleted_at: null\n    }\n  ]\n}\n```\n\n**Create (upload) media file:**\n\n```javascript\nconst fs = require(\"fs\");\nconst fileName = \"test.jpg\";\nconst stream = fs.createReadStream(`/path/to/${fileName}`);\nconst fileType = \"image/jpeg\";\nconst title = \"A Media Item\";\nconst binId = \"media bin ID\";\nconst groupId = \"media group ID, use bin ID for root folder in bin\";\n\ntry {\n  const createFileResponse = await zesty.createMediaFile(\n    binId,\n    groupId,\n    fileName,\n    title,\n    fileType,\n    stream\n  );\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'File uploaded',\n  status: 'Created',\n  data: [\n    {\n      id: '\u003cFile ZUID\u003e',\n      bin_id: '\u003cBin ZUID\u003e',\n      group_id: '\u003cGroup ZUID\u003e',\n      filename: '\u003cFile name\u003e',\n      title: '\u003cFile display name\u003e',\n      url: '\u003cURL to file\u003e',\n      type: 'file'\n    }\n  ],\n  code: 201\n}\n```\n\n**Update media file by ID:**\n\n(Allows ability to change file name, display title, group that the file is in).\n\n```javascript\nconst fileId = \"media file ID\";\nconst newName = \"newname.jpg - optional\";\nconst newTitle = \"New Title - optional\";\nconst newGroup = \"new group ID - optional\";\n\ntry {\n  const updateFileResponse = await zesty.updateMediaFile(fileId, {\n    filename: newName,\n    title: newTitle,\n    group_id: newGroup\n  });\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: 'Updated file \u003cFile Name\u003e',\n  status: 'OK',\n  code: 200,\n  data: [\n    {\n      id: '\u003cFile ZUID\u003e',\n      group_id: '\u003cGroup ZUID\u003e',\n      title: '\u003cFile Display Title\u003e',\n      filename: '\u003cFile Name\u003e',\n      url: '\u003cURL to file\u003e'\n    }\n  ]\n}\n```\n\n**Delete media file by ID:**\n\n```javascript\nconst fileId = \"media file ID\";\n\ntry {\n  const deleteFileResponse = await zesty.deleteMediaFile(fileId);\n} catch (err) {\n  console.log(err);\n}\n```\n\nAbbreviated response format:\n\n```javascript\n{\n  message: '1 files deleted and purging',\n  status: 'OK',\n  code: 200\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzesty-io%2Fzestyio-node-api-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzesty-io%2Fzestyio-node-api-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzesty-io%2Fzestyio-node-api-wrapper/lists"}