RE: how to send expando value/add-values in attribute Values jsonws api

thumbnail
Ramalingaiah. D, modified 6 Years ago. Expert Posts: 489 Join Date: 8/16/14 Recent Posts
Hi,

i am using api jsonws :   http://localhost:8080/api/jsonws?contextName=&signature=%2Fexpandovalue%2Fadd-values-5-long-java.lang.String-java.lang.String-long-java.util.Map#serviceResults

companyId:20099

className : com.liferay.portal.kernel.model.User

tableName :CUSTOM_FIELDS

classPK: 34987

attributeValues:  [{"companyId":20099,"className":"com.liferay.portal.kernel.model.User","tableName":"CUSTOM_FIELDS","classPK":366967,"attributeValues":"venu"},{"companyId":20099,"className":"com.liferay.portal.kernel.model.User","tableName":"CUSTOM_FIELDS","classPK":36967,"attributeValues":testtt}]


Error message :  
"java.util.HashMap cannot be cast to java.util.List; <--- java.lang.ClassCastException: java.util.HashMap cannot be cast to java.util.List"
how to send  java.util.Map parameters
please help out me 


Thank you 
Ram
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hi Ram, 

I've never actually tried this particular JSONWS before, but I'll give this one a shot. Currently in your code you are creating this --
{
    "companyId": 20099,
    "className": "com.liferay.portal.kernel.model.User",
    "tableName": "CUSTOM_FIELDS",
    "classPK": 366967,
    "attributeValues": "venu"
}​​​​​​​

but the attributeValues needs to be a map, so I think like this --
​​​​​​​{
    "companyId": 20099,
    "className": "com.liferay.portal.kernel.model.User",
    "tableName": "CUSTOM_FIELDS",
    "classPK": 366967,
    "attributeValues": {
         ...
    }
}


so if you change your logic to produce something like this --
​​​​​​​{
    "companyId": 20099,
    "className": "com.liferay.portal.kernel.model.User",
    "tableName": "CUSTOM_FIELDS",
    "classPK": 366967,
    "attributeValues": {
​​​​​​​        "expando-field-name":"venue"
  }
}
maybe it will work? I'm just going off of what I am seeing in the Expando API where it takes the Map<String, Serializable> and then does entry.getKey() and entry.getVaue() ... so I suspect your getKey() needs to return the custom field name that you configured and the value would be whatever you want to set it to.

​​​​​​​Let me know if that works! emoticon
thumbnail
Ramalingaiah. D, modified 6 Years ago. Expert Posts: 489 Join Date: 8/16/14 Recent Posts
Hi Andrew Jardine,

this is code     
{"Location":"abcd", "Contact":"79797998"}



it is working fine, thank you so much.


Reagrds
Ram