• 0 Vote(s) - 0 Average
  • 5
  • 4
  • 3
  • 2
  • 1
Thread Modes

REST API - Asset Information
#1
Hello

I'm trying to get the assigned user and status of assets from EasyVista using REST and I'm having a few issues.

I can get the assigned user if I search for an asset;
Code:
https://{company}.easyvista.com/api/v1/{account}/assets?search=asset_tag:{asset_tag}
Which will return
Code:
{
   HREF: https://{company}.easyvista.com/api/v1/{account}/assets?search=asset_tag:{asset_tag},
   record_count: 1,
   total_record_count: 1,
   records: [
       {
           HREF: https://{company}.easyvista.com/api/v1/{account}/assets/{asset_id},
           ASSET_LABEL: ,
           ASSET_TAG: {asset_tag},
           END_OF_WARANTY: ,
           ENTRY_DATE: {datetime},
           INSTALLATION_DATE: {datetime},
           PURCHASE_DATE: {datetime},
           SERIAL_NUMBER: {serial_number},
           LOCATION: {
               HREF: https://{company}.easyvista.com/api/v1/{account}/locations/{location_id},
               CITY: ,
               LOCATION_CODE: {location_code},
               LOCATION_EN: {location_en},
               LOCATION_PATH: {location_path}
           },
           DEPARTMENT: {
               HREF: https://{company}.easyvista.com/api/v1/{account}/departments/{department_id},
               DEPARTMENT_CODE: {department_code},
               DEPARTMENT_EN: {department_en},
               DEPARTMENT_PATH: {department_path},
               DEPARTMENT_LABEL: {department_label}
           },
           EMPLOYEE: {
               HREF: https://{company}.easyvista.com/api/v1/{account}/employees/{employee_id},
               BEGIN_OF_CONTRACT: {datetime},
               CELLULAR_NUMBER: ,
               DEPARTMENT_PATH: {department_path},
               E_MAIL: {e_mail},
               LAST_NAME: {last_name},
               LOCATION_PATH: {location_path},
               PHONE_NUMBER: {phone_number}
           }
       }
   ]
}

If I view a specific asset by ID number 
Code:
https://{company}.easyvista.com/api/v1/{account}/assets/{asset_id}
it won't return the assigned user information;
Code:
{
   HREF: https://{company}.easyvista.com/api/v1/{account}/assets/{asset_id},
   ASSET_GUID: {asset_guid},
   ASSET_ID: {asset_id},
   ASSET_LABEL: ,
   ASSET_TAG: {asset_tag},
   AUTOMATIC_RENEWAL: ,
   AVAILABLE_FIELD_1: ,
   AVAILABLE_FIELD_2: ,
   AVAILABLE_FIELD_3: ,
   AVAILABLE_FIELD_4: ,
   AVAILABLE_FIELD_5: ,
   AVAILABLE_FIELD_6: ,
   BEFORE_LOAN_DEPARTMENT_PATH: ,
   BEFORE_LOAN_LOCATION_ID: ,
   BILLING_PERIODICITY_IN_MONTH: ,
   BUDGET_ID: ,
   BUY_BACK_VALUE: ,
   BUY_BACK_VALUE_CUR_ID: ,
   CHARGE_BACK: {value},
   CHARGE_BACK_CUR_ID: ,
   CI_BACKUP_BY_DEFAULT: ,
   CI_VERSION: ,
   CM_DEFAULT_CHANGE_PATH: ,
   COMMENT_ASSET: {
       HREF: https://{company}.easyvista.com/api/v1/{account}/assets/comment_asset/{asset_id}
   },
   D_HARDWARE_GUID: ,
   DELIVERY_DATE: {datetime},
   DELIVERY_NUMBER: ,
   DEPARTMENT_PATH: {department_path},
   END_OF_WARANTY: {datetime},
   ENTRY_DATE: {datetime},
   ESTIMATED_PERCENTAGE_USE: {value},
   EXPECTED_END_LEND_DATE: ,
   EXPECTED_RETURN_DATE: ,
   FALLEN_TERM: ,
   FIXED_ASSET_NUMBER:  -,
   INITIAL_START: ,
   INSTALLATION_DATE: {datetime},
   INTERNAL_DELIVERY_DATE: ,
   INTERNAL_DISPO: ,
   INVENTORY_ID: ,
   INVOICE_NUMBER: ,
   IS_CI: {value},
   IS_DML: {value},
   IS_LOCKED: {value},
   IS_SERVICE: {value},
   LAST_AUTOMATIC_DISCOVERY: ,
   LAST_INTEGRATION: ,
   LAST_PAYMENT: ,
   LAST_PAYMENT_CUR_ID: ,
   LAST_PHYSICAL_INVENTORY: ,
   LAST_UPDATE: {datetime},
   LICENSE_VERSION: ,
   LOCATION_PATH: {location_path},
   MAINTENANCE_COST: ,
   MAINTENANCE_COST_CUR_ID: ,
   MAX_INSTALLS: ,
   MONTH_DURATION: ,
   MONTHLY_FIXED_COST: ,
   MONTHLY_FIXED_COST_CUR_ID: ,
   MONTHLY_NET_RENTAL: ,
   MONTHLY_NET_RENTAL_CUR_ID: ,
   NETWORK_IDENTIFIER:  -,
   NEXT_CI_VERSION: ,
   NEXT_DEPARTMENT_PATH: ,
   NEXT_MAINTENANCE_DATE: ,
   NEXT_USER_APPLICATION_DATE: ,
   NOTICE: ,
   ORDER_NUMBER: {order_number},
   PACKAGE_PATH: ,
   POWER_CONSUMPTION_WH: {value},
   PROCESSOR_COUNT: ,
   PROCESSOR_SOCKET_COUNT: ,
   PROVIDER_PATH: ,
   PURCHASE_DATE: {datetime},
   PURCHASE_PRICE: {value},
   PURCHASE_PRICE_CUR_ID: ,
   PURCHASE_RATE_ID: ,
   RECYCLED_DATE: ,
   RECYCLING_PROVIDER_PATH: ,
   REFORM_NUMBER: ,
   REMOVED_DATE: ,
   RENEWAL_VALUE: ,
   RENEWAL_VALUE_CUR_ID: ,
   REPAIRED_BY_PATH: ,
   RESALES_VALUE: ,
   SCHEDULED_END: {datetime},
   SD_CATALOG_PATH: ,
   SD_DEFAULT_INCIDENT_PATH: ,
   SD_DEFAULT_REQUEST_PATH: ,
   SERIAL_NUMBER: {serial_number},
   SERVER_TYPE_ID: ,
   SUPPLIER_PATH: {supplier_path},
   TERM: ,
   UPDATE_COVERAGE_TERM: ,
   UPDATED_BY_DISCOVERY: {value},
   XPOS: ,
   YPOS: ,
   ZPOS: ,
   LOCATION: {
       HREF: https://{company}.easyvista.com/api/v1/{account}/locations/{location_id},
       CITY: ,
       LOCATION_CODE: {location_code},
       LOCATION_EN: {location_en},
       LOCATION_PATH: {location_path}
   },
   DEPARTMENT: {
       HREF: https://{company}.easyvista.com/api/v1/{account}/departments/{department_id},
       DEPARTMENT_CODE: {department_code},
       DEPARTMENT_EN: {department_en},
       DEPARTMENT_PATH: {department_path},
       DEPARTMENT_LABEL: {department_label}
   }
}

And neither searching or viewing by asset ID returns the asset status, which I believe is the status_id field based on the example in the REST API - Create an asset wiki page and the EN-EasyVista DataModel 2016.267 spreadsheet. So I tried running;
Code:
https://{company}.easyvista.com/api/v1/{account}/assets?search=asset_tag:{asset_tag}&fields=status_id
Which only returned the asset ID URI;
Code:
{
   HREF: https://{company}.easyvista.com/api/v1/{account}/assets?search=asset_tag:{asset_tag}&fields=status_id,
   record_count: 1,
   total_record_count: 1,
   records: [
       {
           HREF: https://{company}.easyvista.com/api/v1/{account}/assets/{asset_id}
       }
   ]
}

I also tried
Code:
https://{company}.easyvista.com/api/v1/{account}/assets/{asset_id}?fields=status_id
which just returned the same information as
Code:
https://{company}.easyvista.com/api/v1/{account}/assets/{asset_id}


We have a report that returns asset tag, assigned user, and status along with a few other things, so I tried to execute the report using the information in the REST API - Execute an internal query wiki page. I ran the following;
Code:
https://{company}.easyvista.com/api/v1/{account}/internalqueries?queryguid={queryid}
Which returned;
Code:
{error: Internal error}{ }

I'm not 100% I used the right queryguid because I got it by viewing the report in a web browser and parsing the QUERYID= section of the URL. I also tried enclosing the queryguid in curly braces because the QUERYID= section had it in curly braces, but that also returned the "Internal error".

So to my questions, is there any way to retrieve asset status using the REST API? Would the internal query be the way to get it? And is there any way to return the assigned user information when viewing by asset ID?

Thanks in advance.
joshua.campbell, proud to be a member of EV CONNECT FORUM since Aug 2017.

#2
Hello


Quote:If I view a specific asset by ID number  
Code :
https://{company}.easyvista.com/api/v1/{.../{asset_id}
it won't return the assigned user information;
=> It's true, perhaps a bug or a lack of developpement


Quote:https://{company}.easyvista.com/api/v1/{...?queryguid={queryid}

=> Must used a GUID, not a ID

Here is an example of GET internal query that catch AssetManagement/Hardware/Inventory "in service" by list

queryguid=0BD2F7E5-065E-4FA6-A853-9C849097F547 (hardware inventory)
filterguid=CA9DB0E0-062F-425F-88B6-B82DD7228B10 (in service)
viewguid=9E60FED7-A5BE-4449-93D9-5E352527771F (list)
max_rows

Code:
https://{company}.easyvista.com/api/v1/{account}/internalqueries?queryguid=0BD2F7E5-065E-4FA6-A853-9C849097F547&filterguid=CA9DB0E0-062F-425F-88B6-B82DD7228B10&viewguid=9E60FED7-A5BE-4449-93D9-5E352527771F&max_rows=10

Result :
{
    "HREF": "https://{company}.easyvista.com/api/v1/{account}/internalqueries?queryguid=0BD2F7E5-065E-4FA6-A853-9C849097F547&filterguid=CA9DB0E0-062F-425F-88B6-B82DD7228B10&viewguid=9E60FED7-A5BE-4449-93D9-5E352527771F&max_rows=10",
    "recordcount": 10,
    "previouspage": 0,
    "nextpage": 0,
    "records": [
        {
            "Code matériel": "013166",
            "Modèle": "LASERJET 1300",
            "N° de série": "xxxxxxx",
            "Identifiant réseau": " -",
            "Utilisateur principal": "xxxxxxxxx",
            "Statut": "En service",
            "Date de renouvellement prévu": ""
        }, ....

It's easy to find viewguid and filterguid : 
  1. Go to easyvista menu
  2. Active desired view
  3. Copy URL in clipboard and find "q2_r" value
  4. &q2_r=%7B9E60FED7-A5BE-4449-93D9-5E352527771F%7D; substract %7B { and %7D }
  5. Active desired filter
  6. Copy URL in clipboard and find "q2_f" value
  7. &q2_f=%7BCA9DB0E0-062F-425F-88B6-B82DD7228B10%7D; substract %7B { and %7D }
More difficult to find queryguid (it's the main query that collect field) :
  1. Go to easyvista menu
  2. Add "&showstatement=yes" at the end of URL and confirm
  3. Find the line "Current GUID"
  4. Current GUID : {0BD2F7E5-065E-4FA6-A853-9C849097F547}
Same way to find SOAP internal query GUID : https://wiki.easyvista.com/xwiki/bin/vie...ernalQuery
 

P.ABBE
ABBE Philippe, proud to be a member of EV CONNECT FORUM since Nov 2015.






Users browsing this thread: 1 Guest(s)