Unable to update items in the CMS?

Somewhat of a weird issue i’m running into but was hoping for some help. I’m pulling model items from the CMS and comparing them to items from squares API. I compare time stamps, and if square item has a more recent time stamp than what’s in the cms, i overwrite the cms item with data from square. However in testing this, the PUT method is overwriting random items in the CMS, and not the ones i’m targeting using a unique id. any thoughts?

Weird! Do you have an example API call with item ID that updates the wrong item?

 Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: Gunzip {
      _writeState: [Uint32Array],
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      bytesWritten: 0,
      _handle: [Zlib],
      _outBuffer: <Buffer 7b 22 65 72 72 6f 72 22 3a 7b 22 6e 61 6d 65 22 3a 22 4e 6f 74 46 6f 75 6e 64 45 72 72 6f 72 22 2c 22 73 74 61 74 75 73 43 6f 64 65 22 3a 34 30 34 2c ... 16334 more bytes>,
      _outOffset: 0,
      _chunkSize: 16384,
      _defaultFlushFlag: 2,
      _finishFlushFlag: 2,
      _defaultFullFlushFlag: 3,
      _info: undefined,
      _maxOutputLength: 4294967296,
      _level: -1,
      _strategy: 0,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null,
      [Symbol(kError)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: '<https://studio.plasmic.app/api/v1/cms/rows/3smqoyLxhLvJbAFkV3dsw2?publish=1>',
    status: 404,
    statusText: 'Not Found',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }

That is the response

Here is an example of an item I’m passing to the PUT method

{
    id: '25nEJRQiM3Yf4ZoLgJ3VYc',
    createdAt: '2022-09-02T19:08:20.130Z',
    updatedAt: '2022-09-02T19:08:20.130Z',
    identifier: 'baklawa',
    data: {
      name: 'baklawa',
      description: 'pistachio, walnut, orange blossom water',
      price: 350,
      category: 'sweets',
      dietaryInfo: 'v ',
      addOns: '',
      publishToGuestMenu: true,
      timeStamp: '2022-09-12T17:08:44.24Z',
      uid: '4PNH7LVFXFSYP3WPGTZB2K6V',
      dayPart: 'all day',
      restaurantName: 'hanoon'
    }

So in this case, nothing is happening. Sometimes it replaces the data object with another menu items data object. So the identifier would be “baklawa” but the data object would be for a “hummus” item. It should be updating the info within the data object, but nothing is being overwritten

It’s getting a 404, apparently that CMS row was deleted at UTC 2022-09-12 17:52:59.347000 +00:00

Is the rowID referencing the specific item ID?

Might be a silly question

That’s right

const putToPlasmic = async (updateItem) => {
  const CMS_ID = process.env.CMS_ID;
  const CMS_SECRET_TOKEN = process.env.CMS_SECRET_TOKEN;
  const rowId = "3smqoyLxhLvJbAFkV3dsw2";

So in this case, I should have const rowID = updateItem.id

Got it, thank you so much yang

Yeah, you should only need to specify the rowID in the URL, and don’t need to include it in the body

For some reason I thought the rowID was pointing to the models. Got it all worked out. I’m still struggling with the frontend, is there any way I could schedule a meeting with the Vue engineer to get some insight?