CMDBuild Forum

REST client problem - Cannot retrieve SerialNumber

Hello CMDBuild team!

I use REST to get data from cmdbuild and so far I can get what I need.

However, I recently discovered an issue.

 

Particularly, when I GET  ....../services/rest/v2/classes/Asset/cards   I actually can get successfully all attributes I am interested in, except one: the SerialNumber attribute! I always get this as NULL, even though I can see the non-NULL values in the web interface of cmdbuild.

 

Could you please check if it's only my error or not?

 

Thank you,

Dimitris

Dear Dimitris,
 
we would need more details for check your issue. Are you able to provide:
* the class schema and, in particular, the configuration of the "SerialNumber" attribute
* the privileges of the user that executes the request
 
A copy of the database (without sensitive data) would be very helpful.
 
Best regards.
 
-- CMDBuild Team
 
Previously Dimitris wrote:

Hello CMDBuild team!

I use REST to get data from cmdbuild and so far I can get what I need.

However, I recently discovered an issue.

 

Particularly, when I GET  ....../services/rest/v2/classes/Asset/cards   I actually can get successfully all attributes I am interested in, except one: the SerialNumber attribute! I always get this as NULL, even though I can see the non-NULL values in the web interface of cmdbuild.

 

Could you please check if it's only my error or not?

 

Thank you,

Dimitris

 

Thank you for your reply,

 

the class is the "Device" class (under the Assets) and all its sub-classes "Heater" "NetworkDevice", "Computer", "Phone", "GenericItDevice", etc.

The attributes of that class and subclasses are unchanged as provided initially by cmdbuild (actually openmaint).

The user has superuser rights. It's the admin user that I use for the REST webservices.

Unfortunately I cannot provide db copy.

 

Any help is greatly appreciated.

Dimitris

Dear Dimitris,
 
we restored OpenMaint empty database, and we created a card for class "Heater". Then we tried to query "Heater" cards using "admin" user
 
$ curl "http://localhost:8080/cmdbuild/services/rest/v2/classes/Heater/cards" -H "Content-Type: application/json" -H "CMDBuild-Authorization: $REST_SESSION_ID" -X GET -v | json_pp 
* Hostname was NOT found in DNS cache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /cmdbuild/services/rest/v2/classes/Heater/cards HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8080
> Accept: */*
> Content-Type: application/json
> CMDBuild-Authorization: l912k4np1a2mr78erd28hnjp8e
< HTTP/1.1 200 OK
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Date: Mon, 13 Jun 2016 11:10:41 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
{ [data not shown]
100  1057    0  1057    0     0  14873      0 --:--:-- --:--:-- --:--:-- 14887
* Connection #0 to host localhost left intact
{
   "meta" : {
      "references" : {},
      "total" : 1,
      "positions" : {}
   },
   "data" : [
      {
         "IsInRoom" : null,
         "Efficiency" : null,
         "Availability" : null,
         "Weight" : null,
         "WarrantyCode" : null,
         "NoiseLevel" : null,
         "Model" : null,
         "IsInFloor" : null,
         "AmortizationEnd" : null,
         "Code" : null,
         "SerialNumber" : "HEATER",
         "Plant" : null,
         "AssetStatus" : null,
         "Installer" : null,
         "Condition" : null,
         "Area" : null,
         "HeatingCapacity" : null,
         "WarrantyEnd" : null,
         "IsInBuilding" : null,
         "DisposalDate" : null,
         "AcceptanceDate" : null,
         "_type" : "Heater",
         "FullyDepreciated" : false,
         "WarrantyStart" : null,
         "Colour" : null,
         "PurchaseRequest" : null,
         "WarrantyType" : null,
         "Description" : "An heater",
         "Width" : null,
         "Group" : null,
         "Warehouse" : null,
         "LastCheckDate" : null,
         "PurchasePrice" : null,
         "Notes" : null,
         "Category" : null,
         "Fuel" : null,
         "Supplier" : null,
         "IsInUnit" : null,
         "Height" : null,
         "InvoiceNumber" : null,
         "Life" : null,
         "AnnualAmortization" : null,
         "Manufacturer" : null,
         "IsInComplex" : null,
         "PowerConsumption" : null,
         "AmortizationStart" : null,
         "Criticality" : null,
         "Depth" : null,
         "InstallationDate" : null,
         "AssetUser" : null,
         "MinTemp" : null,
         "ModelData" : null,
         "_id" : 240304,
         "CurrentValue" : null,
         "MaxTemp" : null
      }
   ]
}
but "SerialNumber" attribute was not null. The same for "Device" cards:
 
$ curl "http://localhost:8080/cmdbuild/services/rest/v2/classes/Device/cards" -H "Content-Type: application/json" -H "CMDBuild-Authorization: $REST_SESSION_ID" -X GET -v | json_pp 
* Hostname was NOT found in DNS cache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /cmdbuild/services/rest/v2/classes/Device/cards HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8080
> Accept: */*
> Content-Type: application/json
> CMDBuild-Authorization: l912k4np1a2mr78erd28hnjp8e
< HTTP/1.1 200 OK
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Date: Mon, 13 Jun 2016 11:12:33 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
{ [data not shown]
100  1057    0  1057    0     0  13960      0 --:--:-- --:--:-- --:--:-- 14093
* Connection #0 to host localhost left intact
{
   "meta" : {
      "positions" : {},
      "references" : {},
      "total" : 1
   },
   "data" : [
      {
         "MaxTemp" : null,
         "Condition" : null,
         "LastCheckDate" : null,
         "Height" : null,
         "_type" : "Heater",
         "Life" : null,
         "_id" : 240304,
         "AnnualAmortization" : null,
         "Criticality" : null,
         "AcceptanceDate" : null,
         "Notes" : null,
         "ModelData" : null,
         "InstallationDate" : null,
         "PurchaseRequest" : null,
         "Colour" : null,
         "Group" : null,
         "AssetUser" : null,
         "IsInRoom" : null,
         "HeatingCapacity" : null,
         "Description" : "An heater",
         "Width" : null,
         "Depth" : null,
         "Supplier" : null,
         "IsInFloor" : null,
         "AssetStatus" : null,
         "Manufacturer" : null,
         "WarrantyStart" : null,
         "Warehouse" : null,
         "IsInUnit" : null,
         "Category" : null,
         "MinTemp" : null,
         "Installer" : null,
         "Model" : null,
         "FullyDepreciated" : false,
         "Code" : null,
         "Efficiency" : null,
         "CurrentValue" : null,
         "AmortizationEnd" : null,
         "IsInBuilding" : null,
         "WarrantyCode" : null,
         "PurchasePrice" : null,
         "Availability" : null,
         "Fuel" : null,
         "Plant" : null,
         "SerialNumber" : "HEATER",
         "WarrantyEnd" : null,
         "Weight" : null,
         "InvoiceNumber" : null,
         "DisposalDate" : null,
         "NoiseLevel" : null,
         "WarrantyType" : null,
         "PowerConsumption" : null,
         "IsInComplex" : null,
         "Area" : null,
         "AmortizationStart" : null
      }
   ]
}
 
Are you able to provide us some steps, starting from an empty database, for replicate the issue?
 
Best regards.
 
-- CMDBuild Team
 
Previously Dimitris wrote:

Thank you for your reply,

 

the class is the "Device" class (under the Assets) and all its sub-classes "Heater" "NetworkDevice", "Computer", "Phone", "GenericItDevice", etc.

The attributes of that class and subclasses are unchanged as provided initially by cmdbuild (actually openmaint).

The user has superuser rights. It's the admin user that I use for the REST webservices.

Unfortunately I cannot provide db copy.

 

Any help is greatly appreciated.

Dimitris