> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateItem # Package: benefitPrograms # Namespace: ItemService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/items/update-item.md ## Permission Scopes: Manage benefit programs: SCOPE.BENEFIT_PROGRAMS.MANAGE ## Introduction Updates a benefit item. Each time the benefit item is updated, `revision` increments by 1. The current `revision` must be passed when updating the benefit item. This ensures you're working with the latest benefit item and prevents unintended overwrites. --- ## REST API ### Schema ``` Method: updateItem Description: Updates a benefit item. Each time the benefit item is updated, `revision` increments by 1. The current `revision` must be passed when updating the benefit item. This ensures you're working with the latest benefit item and prevents unintended overwrites. URL: https://www.wixapis.com/benefit-programs/v1/items/{item.id} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: item, item.id, item.revision Method parameters: param name: item | type: Item | required: true - name: id | type: string | description: Benefit item GUID. | required: true - name: revision | type: string | description: Revision number, which increments by 1 each time the benefit item is updated. To prevent conflicting changes, the current revision must be passed when updating the benefit item. Ignored when creating a benefit item. | required: true - name: displayName | type: string | description: Benefit item display name. - name: extendedFields | type: ExtendedFields | description: Custom field data for the benefit item object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). Return type: UpdateItemResponse - name: item | type: Item | description: Updated item. - name: id | type: string | description: Benefit item GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the benefit item is updated. To prevent conflicting changes, the current revision must be passed when updating the benefit item. Ignored when creating a benefit item. - name: createdDate | type: string | description: Date and time the item was created. - name: updatedDate | type: string | description: Date and time the item was updated. - name: externalId | type: string | description: GUID of the item in the app providing it. For example, if the item is a product provided by Wix Stores, the `externalId` would be the Wix Stores `product Id`. - name: category | type: string | description: Benefit item category. - name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of. - name: displayName | type: string | description: Benefit item display name. - name: providerAppId | type: string | description: GUID of the [app](https://dev.wix.com/docs/rest/articles/getting-started/apps-created-by-wix.md) that defines and provides the item. For example, if the item is a Wix Stores product, this field's value is `215238eb-22a5-4c36-9e7b-e7c08025e04e`. - name: extendedFields | type: ExtendedFields | description: Custom field data for the benefit item object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. ``` ### Examples ### UpdateItem ```curl ~~~cURL curl -X PATCH \ "https://www.wixapis.com/benefit-programs/v1/items/9d030ee9-f656-4a5c-8318-266a22aff552" -H 'Content-type: application/json' \ -H 'Authorization: ' \ --data '{ "item": { "display_name": "Ticket", "id": "9d030ee9-f656-4a5c-8318-266a22aff552", "revision": "1", }, "field_mask": { "paths": [ "displayName", "externalId" ] } }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.benefitPrograms.ItemService.updateItem(_id, item) Description: Updates a benefit item. Each time the benefit item is updated, `revision` increments by 1. The current `revision` must be passed when updating the benefit item. This ensures you're working with the latest benefit item and prevents unintended overwrites. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: item, _id, item.revision Method parameters: param name: _id | type: string | description: Benefit item GUID. | required: true param name: item | type: UpdateItem | required: true - name: revision | type: string | description: Revision number, which increments by 1 each time the benefit item is updated. To prevent conflicting changes, the current revision must be passed when updating the benefit item. Ignored when creating a benefit item. | required: true - name: displayName | type: string | description: Benefit item display name. - name: extendedFields | type: ExtendedFields | description: Custom field data for the benefit item object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). Return type: PROMISE - name: _id | type: string | description: Benefit item GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the benefit item is updated. To prevent conflicting changes, the current revision must be passed when updating the benefit item. Ignored when creating a benefit item. - name: _createdDate | type: Date | description: Date and time the item was created. - name: _updatedDate | type: Date | description: Date and time the item was updated. - name: externalId | type: string | description: GUID of the item in the app providing it. For example, if the item is a product provided by Wix Stores, the `externalId` would be the Wix Stores `product Id`. - name: category | type: string | description: Benefit item category. - name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of. - name: displayName | type: string | description: Benefit item display name. - name: providerAppId | type: string | description: GUID of the [app](https://dev.wix.com/docs/rest/articles/getting-started/apps-created-by-wix.md) that defines and provides the item. For example, if the item is a Wix Stores product, this field's value is `215238eb-22a5-4c36-9e7b-e7c08025e04e`. - name: extendedFields | type: ExtendedFields | description: Custom field data for the benefit item object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. ``` ### Examples ### updateItem ```javascript import { items } from '@wix/benefit-programs'; async function updateItem(_id,item) { const response = await items.updateItem(_id,item); }; ``` ### updateItem (with elevated permissions) ```javascript import { items } from '@wix/benefit-programs'; import { auth } from '@wix/essentials'; async function myUpdateItemMethod(_id,item) { const elevatedUpdateItem = auth.elevate(items.updateItem); const response = await elevatedUpdateItem(_id,item); } ``` ### updateItem (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { items } from '@wix/benefit-programs'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { items }, // Include the auth strategy and host as relevant }); async function updateItem(_id,item) { const response = await myWixClient.items.updateItem(_id,item); }; ``` ---