Foros de discusión
Send Custom Field Value with JSON WS Request
Pawan Thakur, modificado hace 8 años.
Send Custom Field Value with JSON WS Request
Junior Member Mensajes: 37 Fecha de incorporación: 11/05/15 Mensajes recientes
Hello,
I have created an extra field in Document Library using CUSTOM FIELDS feature, so all my documents and Folders will have this field saying BusinessID which is a parameter I will expect from the Webservice Consumers.
I cannot find a reference to how I can send value for this custom field in my ADD FILE or FOLDER requests (JSONWS API calls)
Any help is appreciated.
Thanks,
Pawan
I have created an extra field in Document Library using CUSTOM FIELDS feature, so all my documents and Folders will have this field saying BusinessID which is a parameter I will expect from the Webservice Consumers.
I cannot find a reference to how I can send value for this custom field in my ADD FILE or FOLDER requests (JSONWS API calls)
Any help is appreciated.
Thanks,
Pawan
Denis Signoretto, modificado hace 8 años.
RE: Send Custom Field Value with JSON WS Request
Expert Mensajes: 375 Fecha de incorporación: 21/04/09 Mensajes recientes
Hi Pawan,
custom field can be passed as attribute of serviceContext parameter. The parameter name to use should be "expandoBridgeAttributes" and should accept a map of values.
Denis.
custom field can be passed as attribute of serviceContext parameter. The parameter name to use should be "expandoBridgeAttributes" and should accept a map of values.
Denis.
Pawan Thakur, modificado hace 8 años.
RE: Send Custom Field Value with JSON WS Request
Junior Member Mensajes: 37 Fecha de incorporación: 11/05/15 Mensajes recientesDenis Signoretto:
Hi Pawan,
custom field can be passed as attribute of serviceContext parameter. The parameter name to use should be "expandoBridgeAttributes" and should accept a map of values.
Denis.
Thanks a ton Denis.
Today only, I visited this issue a few hours back and your response is a nice breakthrough.
I found this https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/service-conte-1
Its clear that while coding in Java we can use it like serviceContext.setAttribute("trackbacks", null);
Considering that my custom field is ABC the Service context should look like in JSON ?
{"expandoBridgeAttributes": [{"ABC": 100 }]}
Can you give a sample reference. thanks in advance.
Cheers,
Pawan
Denis Signoretto, modificado hace 8 años.
RE: Send Custom Field Value with JSON WS Request
Expert Mensajes: 375 Fecha de incorporación: 21/04/09 Mensajes recientes
Hi Pawan,
I'm testing it on Liferay 6.2 CE GA4. I've tryed passing serviceContext in this way {"expandoBridgeAttributes": {"ABC": null}} and it works but whenever I try to put any value for the attribute (different from null) I get the following exception
At the moment, I'm sorry, I didn't find a way to pass the value of expando attributes.
I'm wondering if we are in a issue or if I'm doing something wrong.
Anyway, I hope this help to get closer to the solution!
Bye,
Denis.
I'm testing it on Liferay 6.2 CE GA4. I've tryed passing serviceContext in this way {"expandoBridgeAttributes": {"ABC": null}} and it works but whenever I try to put any value for the attribute (different from null) I get the following exception
{"message":"[ expandoBridgeAttributes.values ]: + Could not find a suitable ObjectFactory for interface java.io.Serializable","exception":"flexjson.JSONException"}
At the moment, I'm sorry, I didn't find a way to pass the value of expando attributes.
I'm wondering if we are in a issue or if I'm doing something wrong.
Anyway, I hope this help to get closer to the solution!
Bye,
Denis.
Pawan Thakur, modificado hace 8 años.
RE: Send Custom Field Value with JSON WS Request
Junior Member Mensajes: 37 Fecha de incorporación: 11/05/15 Mensajes recientesDenis Signoretto:
Hi Pawan,
I'm testing it on Liferay 6.3 CE GA4. I've tryed passing serviceContext in this way {"expandoBridgeAttributes": {"ABC": null}} and it works but whenever I try to put any value for the attribute (different from null) I get the following exception{"message":"[ expandoBridgeAttributes.values ]: + Could not find a suitable ObjectFactory for interface java.io.Serializable","exception":"flexjson.JSONException"}
At the moment, I'm sorry, I didn't find a way to pass the value of expando attributes.
I'm wondering if we are in a issue or if I'm doing something wrong.
Anyway, I hope this help to get closer to the solution!
Bye,
Denis.
It definitely does. Thanks once again.
Denis Signoretto, modificado hace 8 años.
RE: Send Custom Field Value with JSON WS Request
Expert Mensajes: 375 Fecha de incorporación: 21/04/09 Mensajes recientes
Hi Pawan,
I found the solution reading the JSONWS and inner parameters documentation. Being service contenxt an object the best way to pass expando attributes (instead of a whole JSON object) is to call remote service specifing expando attributes (and values) as inner parameters of service context object (e.g. using cURL) in this way :
HTH and solve also for you!
Bye!
Denis.
I found the solution reading the JSONWS and inner parameters documentation. Being service contenxt an object the best way to pass expando attributes (instead of a whole JSON object) is to call remote service specifing expando attributes (and values) as inner parameters of service context object (e.g. using cURL) in this way :
curl -H "Accept: application/json" http://[server]:[port]/api/jsonws/[plugin-context-name.][service-class-name]/[service-method-name] -u user:pass -d serviceContext.expandoBridgeAttributes.myAttributeName1={"value A, value B"} -d serviceContext.expandoBridgeAttributes.myAttributeName2={"value C, value D"}
HTH and solve also for you!
Bye!
Denis.