CMDBuild Forum

Updating lookup or reference attribute with web services

Hello

I have noticed the following difference between SOAP and REST services:
You can successfully update a card with lookup attribute which value is:
1. Integer (lookup id) for both SOAP and REST services.
2. String (lookup description) for SOAP service ONLY. NumberFormatException occurs for REST service.

Hence my first question:
Is it a bug in REST service?

Nowadays neither SOAP nor REST services support a possibility to use string values for reference attributes. Sometimes it is more convenient to use string values instead of integers.

Hence my second question:
Are you going to add this possibility for reference attributes?

Dear Eugeny,
 
we can confirm that it's not a bug. REST supports only integers because that's what lookups/references really are. We agree that description could be used for set lookups and references but there are no constraints for it's uniqueness. So when we designed the actual REST web service we discarded this opportunity.
 
Best regards.
 
-- CMDBuild Team

Previously Eugeny wrote:

Hello

I have noticed the following difference between SOAP and REST services:
You can successfully update a card with lookup attribute which value is:
1. Integer (lookup id) for both SOAP and REST services.
2. String (lookup description) for SOAP service ONLY. NumberFormatException occurs for REST service.

Hence my first question:
Is it a bug in REST service?

Nowadays neither SOAP nor REST services support a possibility to use string values for reference attributes. Sometimes it is more convenient to use string values instead of integers.

Hence my second question:
Are you going to add this possibility for reference attributes?

 

Thank you for the answer!

 

Could you please then give me a hint?

 

In order to substitute string values with corresponsing integer values - is there any way to recognize lookup and reference attributes among others on webservice client side?

Dear Eugeny,
 
our JavaScript clients first of all reads all attribute definitions for the target class, then they can set the right value since they know exactly what kind of attribute it is.
 
Best regards.
 
-- CMDBuild Team

Previously Eugeny wrote:

Thank you for the answer!

 

Could you please then give me a hint?

 

In order to substitute string values with corresponsing integer values - is there any way to recognize lookup and reference attributes among others on webservice client side?

 

Is it possible to read attribute definitions for the target class with SOAP and REST services?

My application manipulates string values. If my application could recognize attribute type as reference/lookup type, then it could react on this by making additional requests to CMDBuild and making substitions from strings to integers then.

 

Thank you!

 

Previously Tecnoteca wrote:
Dear Eugeny,
 
our JavaScript clients first of all reads all attribute definitions for the target class, then they can set the right value since they know exactly what kind of attribute it is.
 
Best regards.
 
-- CMDBuild Team
Of coure you can when using REST. The resource is:
 
.../classes/{" + CLASS_ID + "}/attributes/
 
You can find other information looking at the web service manual (http://www.cmdbuild.org/en/documentazione/manuali?set_language=en&cl=en) or looking at the WADL (e.g. http://host:port/cmdbuild/services/rest/v1?_wadl or http://host:port/cmdbuild/services/rest/v2?_wadl).
 
Best regards.
 
-- CMDBuild Team
 
Previously Eugeny wrote:

Is it possible to read attribute definitions for the target class with SOAP and REST services?

My application manipulates string values. If my application could recognize attribute type as reference/lookup type, then it could react on this by making additional requests to CMDBuild and making substitions from strings to integers then.

 

Thank you!

 

Previously Tecnoteca wrote:
Dear Eugeny,
 
our JavaScript clients first of all reads all attribute definitions for the target class, then they can set the right value since they know exactly what kind of attribute it is.
 
Best regards.
 
-- CMDBuild Team