Hi,
I was trying to save a nested object through setProxyConfig but I always got an error. Here is a sample object I’m trying to send:
{
'method': 'getSessionId',
'jsonrpc': '2.0',
'params': {
'username': 'username',
'password': 'password'
}
}
Is there a way or a work around on saving a nested object through setProxyConfig?
I can’t use stringify because the rest api is returning an error If I use a stringify. Is there a way to edit it before sending the request on kintone.plugin.app.proxy?
Thanks
Vern Montorio
Hi Vern,
Could you please tell the errors you received in details and what you are trying to do with kintone.plugin.app.setProxyConfig()?
Thanks.
Junko
Hi Junko,
I was trying to save a nested object from kintone.plugin.app.setProxConfig() but it always returned “Uncaught Error: Usage: kintone.plugin.app.setProxyConfig(url, method, headers, data, opt_callback)”. Is there a way to save a nested object to kintone.plugin.app.setProxConfig. Here is what my header object look like:
{
'method': 'getSessionId',
'jsonrpc': '2.0',
'params': {
'username': 'username',
'password': 'password'
}
}
Thanks.
Vern
Hi Vern,
Thank you for the information.
Could I ask you what you are trying to accomplish after saving a nested object to kintone.plugin.app.setProxConfig? Thank you.
Junko
Hi Junko,
I was trying to send an api request to rainmaker directly ie.(don’t use backend server to unstringify the params and send the api request there) but it requires me to send a nested object. I was hoping if there is a way to save a nested object to kintone.plugin.app.setProxConfig or unstringify the params before using kintone.plugin.app.proxy. Hope this help.
Thanks,
Vern
Hi Vern,
I see.
Since I only got the request header from you, I am not 100% sure if I am understanding what you are trying to accomplish, but when you are trying to send an array with “setconfig”, you may be able to work around and not get the error if you convert a JavaScript value(parms array) to a JSON string using JSON.stringify as below.
var headers = {}; var parm ={ 'method': 'getSessionId',
'jsonrpc': '2.0', 'params':JSON.stringify({ 'username': 'username', 'password': 'password' }) }; kintone.plugin.app.setProxyConfig('https://xxxx.com','GET', headers, parm, function(e) { });
I am just guessing this"JSON.stringify" might work with the error you get. Therefore, please let me know if you still get an error or solve the issue after trying this.
Good luck!
One more thing! The reason to get this error when you pass the nested object in the parameter might be because this is how “setProxyConfig” method has the limitation of this API as spec per the kintone API documentation as below.
https://developer.kintone.io/hc/en-us/articles/212494958/
What this description above is trying to say is maybe that you need to specify the key and value with a pair format per the example when specifying data in the object type, not using a nested object.
Thank you.
Junko