Platform.api.patch


#1

Hello,

I’m struggling with getting my platform.api.patch script working. When trying it in API docs, it’s working:

I’m using: updateRecordsByFilter() - Update (patch) one or more records
Table_name = Status
body = {“Status_status”:“new”,“Status_approver”:“Johny”}
filter = Status_TT = ‘12345’

With this it should update the items with Status_TT = 12345 with the information in the body. As i said, it works.

When trying to make this server side, i’ve tried many things and the closest i get is:

var queryupdate = '{"Status_status":"new","Status_approver":"Johny"}';
var string3 = JSON.parse(queryupdate);
platform.api.patch("db/status?filter=Status_TT = '12345' ", string3);

The problem is that it updates all the records in that table, including the ones thatdon’t have 12345 under Status_TT

I’ve also tried to do something with

platform.api.patch("db/status", string3, {"filter" : "Status_TT = '12345' "} );

but that doesn’t work at all

It’s probably something very simple and would appreciate if someone could help me with some code examples, i can work out the rest how to apply it to my project

Thanks


#2

Someone must be using this :)?


#3

Maybe try URL-encoding the filter like API Docs does for you.