Skip to main content

So I know 

```

import mondaySdk from "monday-sdk-js";

```

 

mondaySdk has these fuctions

 

async getItem(key: string): Promise<{ data?: { value?: string } }> {

return await this.mondaySdkClient.storage.getItem(key);

}

 

async setItem(key: string, value: string): Promise<any> {

return await this.mondaySdkClient.storage.setItem(key, value);

}

and they work fine in Browser env but I am have app which needs to update the storage from my server env

so for this

```
 

class MondayRestStorage implements StorageBackend {

private mondayToken: string;

 

constructor(token: string) {

this.mondayToken = token;

}

 

async getItem(key: string): Promise<{ data?: { value?: string } }> {

const url = `https://apps-storage.monday.com/app_storage_api/v2/${key}?shareGlobally=false`;

 

const response = await fetch(url, {

method: "GET",

headers: {

Authorization: this.mondayToken,

"Content-Type": "application/json",

"User-Agent": "monday-apps-sdk",

},

});

 

if (!response.ok) {

console.warn(`Storage get failed: ${response.status}`);

return {};

}

 

const result = await response.json();

return {

data: {

value:

typeof result.value === "string"

? result.value

: JSON.stringify(result.value),

},

};

}

 

async setItem(key: string, value: string): Promise<any> {

const url = `https://apps-storage.monday.com/app_storage_api/v2/${key}?shareGlobally=false`;

 

const response = await fetch(url, {

method: "POST",

headers: {

Authorization: this.mondayToken,

"Content-Type": "application/json",

"User-Agent": "monday-apps-sdk",

},

body: JSON.stringify({ value }),

});

 

if (!response.ok) {

console.error("Storage set request failed:", {

status: response.status,

statusText: response.statusText,

url,

body: JSON.stringify({ value }),

});

throw new Error(`Storage set failed: ${response.status}`);

}

 

return response.json();

}

 

async deleteItem(key: string): Promise<any> {

// For deletion, we set an empty value (Monday API doesn't have DELETE)

return this.setItem(key, "");

}

}

```

so her get function works fine 
even set function fine as well if I want to add a new 
“Key” 

but if I want to update a specific Key I get 
Error saving cached timeline data: Error: Storage set failed: 409

please team can you help me with what’s going on and how to fix this
I tried to use PUT request as well but no success

yes my token has all the permissions because get storage works and and also set storage works if i use the new the key

but my use case is to update the specific key values

so let say if I already have storage like = {MASTER:VALUE}
I want to update
{MASTER: NEW_VALUE}

 

Be the first to reply!