Page 1 of 1

Rest API with JS value.replace error

Posted: Thu Apr 23, 2015 11:34 pm
by Justin Price

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


Rest API with JS value.replace error

Posted: Fri Apr 24, 2015 4:43 pm
by Serhii Kulibaba

Rest API with JS value.replace error

Posted: Fri Apr 24, 2015 5:44 pm
by Justin Price

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"


Rest API with JS value.replace error

Posted: Wed Apr 29, 2015 8:02 am
by Serhii Kulibaba

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