CMDBuild Forum

How can I get or update the relations attributes by REST Web Services?

How can I get or update the relations attributes by REST Web Services (REST API)?
I did not understand even if I looked at the webservice-manual.

I think you'll need to give more details if you want an answer, as the REST API is fairly easy to use.
 
Have you tried some commands that didn't work ? If so, post them here so people can double-check them.
 
Previously mamoru wrote:

How can I get or update the relations attributes by REST Web Services (REST API)?
I did not understand even if I looked at the webservice-manual.

 

I created attribute "ApplyDate" in domain "TargetPatch", and created relation and set "ApplyDate" to "2019-07-31".

curl -X GET -H "Content-Type:application/json" -H "CMDBuild-Authorization:3vve0u3wndqayey5eilx10w8" "http://xx.xxx.xx.xx/cmdbuild/services/rest/v3/domains/TargetPatch/relations/4083"

{"success":true,"data":{"_id":4083,"_type":"TargetPatch","_user":"admin","_beginDate":"2019-08-07T07:36:28.97Z","_sourceType":"GLOVIAPatch","_sourceId":2828,"_sourceDescription":"U180930","_sourceCode":"U180930","_destinationType":"Server","_destinationId":2497,"_destinationCode":"002","_destinationDescription":"WindowsServer","_direction":"direct","_is_direct":true,"_can_update":true,"_can_delete":true,"ApplyDate":"2019-07-31"}


When trying to update "ApplyDate" to "2019-08-09" and executing the following API, an error occurs.

curl -X PUT -H "Content-Type:application/json" -H "CMDBuild-Authorization:3vve0u3wndqayey5eilx10w8" "http://xx.xxx.xx.xx/cmdbuild/services/rest/v3/domains/TargetPatch/relations/4083"  -d '{ApplyDate:"2019-08-09"}'

{"success":false,"messages":[{"level":"ERROR","show_user":false,"message":"com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.cmdbuild.service.rest.v3.endpoint.CardRelationWs$WsRelationData, problem: missing '_type' param\n at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@2493fecd; line: 1, column: 24], caused by: java.lang.NullPointerException: missing '_type' param"}]}


Is there a mistake in calling the API?