by Eugene Tolmachov (SherpaDesk IT Developer)
The Importance of Rate Limiting
Last year we explored how to rate limit your API. We explained the advantages and benefits of doing so in order to ride out a big surge in API requests that otherwise would threaten your system (and ours :p ).
Now we'd like to explore the best way to process data in bulk using the SherpaDesk API and how to build effective strategies around it.
Bulk Update and Create Operations
We have now introduced new BULK ADD and UPDATE commands.
The command for previewing available updating items is (PUT) and for new items is (POST).
Bulk operations on Update Assets
Use this API command:
PUT /assets/bulk?format=json
Bulk list contains a list of update requests as a list of URLs.
{
"bulk" :
[
"assets/826717?note=My new note",
"assets/826717?owner_id=909666",
"assets/826717?checkout_id=1032264",
"assets/826717?status_id=1&location_id=171897&unique1_value=10028",
"assets/826717?checkout_id=0"
]
}
Examples
1) This command will update an asset with id 826717 with a new NOTE "My new note":"assets/826717?note=My new note"
2) This command will update an asset with id 826717 with a new Status_id = 1, a new Location_id = 171897, and a new Unique1_value = 10028:
"assets/826717?status_id=1&location_id=171897&unique1_value=10028"
As a result you will get this response log:
[
"Command 1 - Asset with ID:826717 - Updated Success!\n",
"Command 2: nothing to change\n"
]
Bulk Operations On Add Assets
Use this API command:
POST /assets/bulk?format=json
Bulk list contains the list of add requests as a list of URLs.
{ "bulk" :
[
"assets?note=My new note",
"assets?owner_id=909666",
"assets?checkout_id=1032264",
"assets?status_id=1&location_id=171897&unique1_value=10028", "assets/826717?checkout_id=0"
]
}Examples
1) This command will add an asset with a new NOTE "My new note":
"assets/826717?note=My new note"
2) This command will add asset with new Status_id = 1, new Location_id = 171897, and new Unique1_value = 10028:
"assets/826717?status_id=1&location_id=171897&unique1_value=10028"
As a result you will get this response log:
[
"Command 1 - Asset with ID:826717 - Added Success!\n",
"Command 2: nothing to change\n"
]Bulk Operations On Update Profiles
Please use this API command:
PUT /profile/bulk?format=json
Bulk list contains a list of add requests as a list of URLs.
{ "bulk" :
[
"profile/123?title=My new title",
"profile/333?unique_id=909666"
]
}
Bulk Data Operations And Database Backups
We've also introduced a new feature to query any amount of data from our API. You can now export any number of records in CSV format.
Just add Profiles?format=csv and you are able to set whatever limit you require (even &limit=100000).
This feature is now available for Assets, Users, Locations and Accounts.
We plan to add Tickets and other data to this feature soon.
To follow a 302 redirect please use:
$ curl -L [url]
Running this command will automatically handle any 3XX redirects and will retrieve whatever data is returned by the resulting URL.
https://stackabuse.com/follow-redirects-in-curl/
https://github.com/sherpadesk/api/wiki#bulk-data-operations-and-database-backups
Get Database Dump of Locations
You can now obtain all locations with this command:
GET /locations?is_plain=true - get Locations for Account with all Sub-Locations
Note: Please use paging (page and limit)
Important: If you need to backfill data, it is best to do so during non-peak business hours. Also, consider using our CSV exports, which are currently in beta.
SherpaDesk’s Newest API Updates and Features
We've added easy Integration commands to import new data into SherpaDesk.
You can now:
- Create Tickets with Dates
- Create Priorities
- Create Knowledge Bases
- Create Categories
- Create Classes
- Create Accounts
- Create Posts
We’re always working hard to make it easier for you to run your business, and we're always focused on improving SherpaDesk’s usability.
Please join our Google Developer's Support Group to get feedback on any questions you may have.
Eugene & the SherpaDesk Team
comments