It is possible to call the api's using the command line tool curl. This provides a simple way to use and test the api. These examples also use the json_reformat tool provided by the yajl library, which formats the json string to allow for easy viewing.
View all Assets:
curl http://localhost:8080/ehelpdesk/api/assets -u admin:admin -H "Accept: */*" | json_reformat
HTTP/1.1 200 OK
{
"content": [
{
"id": 2,
"assetNumber": "asdfa111",
"name": "asdfa111",
"notes": null,
"acquisitionDate": null,
"assetLocation": null,
"active": true,
"accountingInfo": {
"id": 2,
"poNumber": "po111",
"accountNumber": null,
"accumulatedNumber": null,
"expenseNumber": null,
"acquisitionValue": null,
"leaseNumber": null,
"leaseExpirationDate": null,
"leaseDuration": null,
"leaseFrequency": null,
"leaseFrequencyPrice": null,
"warrantyDate": null,
"disposalDate": null,
"disposalMethod": null,
"insuranceCategory": null,
"replacementValueCategory": null,
"replacementValue": null,
"maintenanceCost": null,
"depreciationMethod": null
},
"macAddress": null,
"osNameType": null,
"osVersion": null,
"netbios": null,
"ip": null,
"osSerial": null,
"netConnectionLoc": null,
"netConnectionDesc": null,
"vlan": null,
"manufacturer": null,
"modelNumber": null,
"serialNumber": null,
"description": null,
"hostname": null,
"vncPort": null,
"assetTypeId": 1,
"vendorId": null,
"ticketIds": [
],
"softwareLicenseIds": [
],
"statusId": 1,
"ownerId": null,
"locationId": null,
"groupId": null,
"categoryId": null,
"categoryOptionId": null
},
{
"id": 3,
"assetNumber": "asdfa1111",
"name": "asdfa111",
"notes": null,
"acquisitionDate": null,
"assetLocation": null,
"active": true,
"accountingInfo": {
"id": 3,
"poNumber": "po111",
"accountNumber": null,
"accumulatedNumber": null,
"expenseNumber": null,
"acquisitionValue": null,
"leaseNumber": null,
"leaseExpirationDate": null,
"leaseDuration": null,
"leaseFrequency": null,
"leaseFrequencyPrice": null,
"warrantyDate": null,
"disposalDate": null,
"disposalMethod": null,
"insuranceCategory": null,
"replacementValueCategory": null,
"replacementValue": null,
"maintenanceCost": null,
"depreciationMethod": null
},
"macAddress": null,
"osNameType": null,
"osVersion": null,
"netbios": null,
"ip": null,
"osSerial": null,
"netConnectionLoc": null,
"netConnectionDesc": null,
"vlan": null,
"manufacturer": null,
"modelNumber": null,
"serialNumber": null,
"description": null,
"hostname": null,
"vncPort": null,
"assetTypeId": 1,
"vendorId": null,
"ticketIds": [
],
"softwareLicenseIds": [
1,
2
],
"statusId": 1,
"ownerId": null,
"locationId": null,
"groupId": null,
"categoryId": null,
"categoryOptionId": null
}
],
"links": [
{
"rel": "self",
"href": "http://localhost:8080/ehelpdesk/api/assets"
}
]
}
|
View Asset with id 1:
curl http://localhost:8080/ehelpdesk/api/assets/2 -u admin:admin -H "Accept: */*" | json_reformat
HTTP/1.1 200 OK
{
"content": {
"id": 2,
"assetNumber": "asdfa111",
"name": "asdfa111",
"notes": null,
"acquisitionDate": null,
"assetLocation": null,
"active": true,
"accountingInfo": {
"id": 2,
"poNumber": "po111",
"accountNumber": null,
"accumulatedNumber": null,
"expenseNumber": null,
"acquisitionValue": null,
"leaseNumber": null,
"leaseExpirationDate": null,
"leaseDuration": null,
"leaseFrequency": null,
"leaseFrequencyPrice": null,
"warrantyDate": null,
"disposalDate": null,
"disposalMethod": null,
"insuranceCategory": null,
"replacementValueCategory": null,
"replacementValue": null,
"maintenanceCost": null,
"depreciationMethod": null
},
"macAddress": null,
"osNameType": null,
"osVersion": null,
"netbios": null,
"ip": null,
"osSerial": null,
"netConnectionLoc": null,
"netConnectionDesc": null,
"vlan": null,
"manufacturer": null,
"modelNumber": null,
"serialNumber": null,
"description": null,
"hostname": null,
"vncPort": null,
"assetTypeId": 1,
"vendorId": null,
"ticketIds": [
],
"softwareLicenseIds": [
],
"statusId": 1,
"ownerId": null,
"locationId": null,
"groupId": null,
"categoryId": null,
"categoryOptionId": null
},
"links": [
{
"rel": "self",
"href": "http://localhost:8080/ehelpdesk/api/assets/2"
}
]
}
|
Create new Asset:
curl http://localhost:8080/ehelpdesk/api/assets -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X POST -d '{"assetNumber": "asdfa113","name": "asdfa111","assetTypeId": 1,"accountingInfo": {"poNumber": "po111"},"statusId": 1}'
HTTP/1.1 201 Created
{
"id": 5,
"assetNumber": "asdfa113",
"name": "asdfa111",
"notes": null,
"acquisitionDate": null,
"assetLocation": null,
"active": true,
"accountingInfo": {
"id": 5,
"poNumber": "po111",
"accountNumber": null,
"accumulatedNumber": null,
"expenseNumber": null,
"acquisitionValue": null,
"leaseNumber": null,
"leaseExpirationDate": null,
"leaseDuration": null,
"leaseFrequency": null,
"leaseFrequencyPrice": null,
"warrantyDate": null,
"disposalDate": null,
"disposalMethod": null,
"insuranceCategory": null,
"replacementValueCategory": null,
"replacementValue": null,
"maintenanceCost": null,
"depreciationMethod": null
},
"macAddress": null,
"osNameType": null,
"osVersion": null,
"netbios": null,
"ip": null,
"osSerial": null,
"netConnectionLoc": null,
"netConnectionDesc": null,
"vlan": null,
"manufacturer": null,
"modelNumber": null,
"serialNumber": null,
"description": null,
"hostname": null,
"vncPort": null,
"assetTypeId": 1,
"vendorId": null,
"ticketIds": [
],
"softwareLicenseIds": [
],
"statusId": 1,
"ownerId": null,
"locationId": null,
"groupId": null,
"categoryId": null,
"categoryOptionId": null
} |
Create new Asset with custom field values:
curl http://localhost:8080/ehelpdesk/api/assets -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X POST -d '{"assetNumber": "asdfa111","name": "asdfa111","assetTypeId": 1,"accountingInfo": {"poNumber": "po111"},"customFieldValues": [{"customFieldId": 1,"fieldValue":"test111"},{"customFieldId": 2,"fieldValue":"test222"}],"statusId": 1}'
HTTP/1.1 201 Created
{
"id": 6,
"assetNumber": "asdfa114",
"name": "asdfa111",
"notes": null,
"acquisitionDate": null,
"assetLocation": null,
"active": true,
"accountingInfo": {
"id": 6,
"poNumber": "po111",
"accountNumber": null,
"accumulatedNumber": null,
"expenseNumber": null,
"acquisitionValue": null,
"leaseNumber": null,
"leaseExpirationDate": null,
"leaseDuration": null,
"leaseFrequency": null,
"leaseFrequencyPrice": null,
"warrantyDate": null,
"disposalDate": null,
"disposalMethod": null,
"insuranceCategory": null,
"replacementValueCategory": null,
"replacementValue": null,
"maintenanceCost": null,
"depreciationMethod": null
},
"macAddress": null,
"osNameType": null,
"osVersion": null,
"netbios": null,
"ip": null,
"osSerial": null,
"netConnectionLoc": null,
"netConnectionDesc": null,
"vlan": null,
"manufacturer": null,
"modelNumber": null,
"serialNumber": null,
"description": null,
"hostname": null,
"vncPort": null,
"assetTypeId": 1,
"vendorId": null,
"ticketIds": [
],
"softwareLicenseIds": [
],
"statusId": 1,
"ownerId": null,
"locationId": null,
"groupId": null,
"categoryId": null,
"categoryOptionId": null
} |
Update existing Asset:
curl http://localhost:8080/ehelpdesk/api/assets/10 -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X PUT -d '{"assetNumber": "asdfa111","name": "asdfa111","assetTypeId": 1,"accountingInfo": {"poNumber": "po111"},"customFieldValues": [{"customFieldId": 1,"fieldValue":"test-111"},{"customFieldId": 2,"fieldValue":"test-222"}],"statusId": 1}'
Update existing Asset:
curl http://localhost:8080/ehelpdesk/api/assets/10 -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X PUT -d '{"id":10,"assetNumber":"asdfa11110","name":"asdfa111","notes":null,"acquisitionDate":null,"parentAsset":null,"assetLocation":null,"active":true,"accountingInfo":{"id":17,"poNumber":"po111","accountNumber":null,"accumulatedNumber":null,"expenseNumber":null,"acquisitionValue":null,"leaseNumber":null,"leaseExpirationDate":null,"leaseDuration":null,"leaseFrequency":null,"leaseFrequencyPrice":null,"warrantyDate":null,"disposalDate":null,"disposalMethod":null,"insuranceCategory":null,"replacementValueCategory":null,"replacementValue":null,"maintenanceCost":null,"depreciationMethod":null},"manufacturer":null,"modelNumber":null,"serialNumber":null,"description":null,"customFieldValues":[],"hostname":null,"vncPort":null,"macAddress":null,"osName":null,"osVersion":null,"netbiosName":null,"ipAddress":null,"osSerialNumber":null,"networkConnectionLocation":null,"networkConnectionDescription":null,"vlan":null,"assetTypeId":1,"vendorId":null,"ticketIds":[],"softwareLicenseIds":[],"statusId":1,"ownerId":null,"locationId":null,"groupId":null,"categoryId":null,"categoryOptionId":null}'
Delete Asset:
curl http://localhost:8080/ehelpdesk/api/assets/1 -u admin:admin -H "Accept: */*" -v -X DELETE
List all AssetCustomFields:
curl -v -u admin:admin http://localhost:8080/ehelpdesk/api/asset-custom-fields
Get one AssetCustomField
curl -v -u admin:admin http://localhost:8080/ehelpdesk/api/asset-custom-fields/1
GET all filter:
curl -v -u admin:admin http://localhost:8080/ehelpdesk/api/asset-filters
GET single filter:
curl -v -u admin:admin http://localhost:8080/ehelpdesk/api/asset-filters/1
POST new filter:
curl http://localhost:8080/ehelpdesk/api/asset-filters -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X POST -d '{"name":"Filter from Curl","privateFilter":true,"assetNumbers":null,"names":null,"typeIds":null,"ownerIds":null,"vendorIds":null,"notes":null,"assetLocations":null,"acquisitionDateOperator":0,"acquisitionDate":"","acquisitionDate2":"","locationIds":null,"groupIds":null,"categoryIds":null,"categoryOptionIds":null,"manufacturers":null,"modelNumbers":null,"serialNumbers":null,"descriptions":null,"statusIds":null,"softLicIds":null,"poNumbers":null,"accountNumbers":["asdf"],"accumulatedNumbers":null,"expenseNumbers":null,"acquisitionValues":null,"leaseNumbers":null,"leaseDurations":null,"leaseFrequencys":null,"leaseFrequencyPrices":null,"disposalMethods":null,"disposalDateOperator":0,"disposalDate":"","disposalDate2":"","insuranceCategories":null,"replacementValuecategories":null,"replacementValues":null,"maintenanceCosts":null,"depreciationMethods":null,"leaseExpirationDateOperator":0,"leaseExpirationDate":"","leaseExpirationDate2":"","warrantyDateOperator":0,"warrantyDate":"","warrantyDate2":"","customFields":{},"columnOrder":["asset.assetNumber","asset.name","asset.location","asset.assetlocation","asset.group","asset.category","asset.categoryoption","accountinginfo.accountnumber"],"report":false,"mainReport":true,"groupBy":1,"showDetail":false,"showPieChart":true,"format":"pdf","userId":0}'
PUT filter
curl http://localhost:8080/ehelpdesk/api/asset-filters/2 -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X PUT -d '{"name":"Filter from Curl modified","privateFilter":true,"assetNumbers":null,"names":null,"typeIds":null,"ownerIds":null,"vendorIds":null,"notes":null,"assetLocations":null,"acquisitionDateOperator":0,"acquisitionDate":"","acquisitionDate2":"","locationIds":null,"groupIds":null,"categoryIds":null,"categoryOptionIds":null,"manufacturers":null,"modelNumbers":null,"serialNumbers":null,"descriptions":null,"statusIds":null,"softLicIds":null,"poNumbers":null,"accountNumbers":["asdf"],"accumulatedNumbers":null,"expenseNumbers":null,"acquisitionValues":null,"leaseNumbers":null,"leaseDurations":null,"leaseFrequencys":null,"leaseFrequencyPrices":null,"disposalMethods":null,"disposalDateOperator":0,"disposalDate":"","disposalDate2":"","insuranceCategories":null,"replacementValuecategories":null,"replacementValues":null,"maintenanceCosts":null,"depreciationMethods":null,"leaseExpirationDateOperator":0,"leaseExpirationDate":"","leaseExpirationDate2":"","warrantyDateOperator":0,"warrantyDate":"","warrantyDate2":"","customFields":{},"columnOrder":["asset.assetNumber","asset.name","asset.location","asset.assetlocation","asset.group","asset.category","asset.categoryoption","accountinginfo.accountnumber"],"report":false,"mainReport":true,"groupBy":1,"showDetail":false,"showPieChart":true,"format":"pdf","userId":0}'
Delete filter
curl -v -u admin:admin -X DELETE http://localhost:8080/ehelpdesk/api/asset-filters/2
Get all AssetTypes:
curl http://localhost:8080/ehelpdesk/api/asset-types -u admin:admin -H "Accept: */*" | json_reformat
Create new AssetType:
curl http://localhost:8080/ehelpdesk/api/asset-types -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X POST -d '{"name":"a42", "notes":"foo"}'
Update AssetType:
curl http://localhost:8080/ehelpdesk/api/asset-types/1 -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X PUT -d '{"name":"a42-x", "notes":"foo-x"}'
Delete AssetType:
curl http://localhost:8080/ehelpdesk/api/asset-types/1 -u admin:admin -v -X DELETE
curl http://localhost:8080/ehelpdesk/api/knowledge-base-articles/1 -u admin:admin -H "Accept: */*" | json_reformat
Get one Ticket:
curl http://localhost:8080/ehelpdesk/api/tickets/1 -u admin:admin -H "Accept: */*" | json_reformat
Create new Ticket:
curl http://localhost:8080/ehelpdesk/api/tickets -u admin:admin -H "Content-Type: application/json" -v -X POST -d '{"subject":"curltest","note":"","contactId":0,"submittedById":0,"assignedToId":1,"priorityId":-3,"statusId":2,"locationId":1,"groupId":1,"categoryId":1,"categoryOptionId":1,"customFieldValues":[]}'
Get one TicketFilter
curl http://localhost:8080/ehelpdesk/api/ticket-filters/1 -u admin:admin -H "Accept: */*" | json_reformat
Get all Users
curl -v -u admin:admin http://localhost:8080/ehelpdesk/api/users | json_reformat
GET single user
curl -v -u admin:admin http://localhost:8080/ehelpdesk/api/users/3 | json_reformat
POST
curl http://localhost:8080/ehelpdesk/api/users -u admin:admin -H "Accept: */*" -H "Content-Type: application/json" -v -X POST -d '{"firstName":"user","lastName":"user","email":"user@user.com","loginId":"user","changePassword":null,"retypePassword":null,"active":true,"onVacation":false,"creationDate":1363896870000,"creator":"SYSTEM ADMIN","comments":"user","colLoginId":"","ldapDN":null,"primaryPhone":null,"addressIds":[],"phoneIds":[],"userRoleIds":[5],"notificationUserRoleGroupIds":[],"locationId":1}'