Justin Price
Posts: 0
Joined: Tue Mar 25, 2014 10:43 pm

Rest API with JS value.replace error

I have a create rest api i am trying to call in javascript.
I am calling it like this.
code
InsertStatus.execute({
parameters: {
data: {
Status: goingtostatus
}
}
});
/code
my database has a column called Status
goingtostatus = either "open" or "close"

when i try to call this i pull open debug tools on my browser and i see an error value.replace is not a function.

Am i calling this wrong or passing parameters wrong?

Thanks

Justin Price
Posts: 0
Joined: Tue Mar 25, 2014 10:43 pm

Rest API with JS value.replace error

ok i changed it to be this instead

codeInsertStatus.execute({
parameters: {
'where': '{"Status": ' + goingtostatus + '}'
}
});/code

It doesn't error anymore however it writes nothing to the database for "Status"

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Rest API with JS value.replace error

1) Add mapping of session token to the "X-Appery-Session-Token" parameter: http://prntscr.com/6zfxhl
2) Use JS below:
preInsertStatus.execute({"data":{"Status":'"' + goingtostatus + '"'}});/pre

Return to “Issues”