1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/docs/api/op_list.md

121 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2020-03-06 16:26:37 +00:00
## List objects
### Querying
You may query the resultset by passing field names as url parameters
### Numeric Queries
On numeric fields you can suffix the field names with the following filters:
- \_\_lt : less-than
- \_\_lte : less-than-equal
- \_\_gt : greater-than
- \_\_gte : greater-than-equal
- \_\_in : value inside set of values (comma separated)
**examples**
?<field_name>__lt=10
?<field_name>__in=1,10
### String Queries
On string fields you can suffix the field names with the following filters:
- \_\_contains : field value contains specified value
- \_\_startswith : field value starts with specified value
- \_\_in : value contained inside set of values (comma separated)
**examples**
?<field_name>__contains=something
?<field_name>__in=this,that
All string filtering operations are case-insensitive
### Since
You can use the since argument with a unix timestamp (seconds) to retrieve all
objects updated since then. Note that this result will contain objects that were
deleted in that timeframe as well - you can spot them by checking for status "deleted"
**example**
?since=1443414678
### Nested data
Any field ending in the suffix **_set** (with the exception of 'irr_as_set') is a list of objects in a relationship with the parent
object, you can expand those lists with the 'depth' parameter as explained below.
The naming schema of the field will always tell you which type of object the set is holding
and will correspond with the object's endpoint on the API
<object_type>_set
So a set called 'net_set' will hold Network objects (api endpoint /net)
### Depth
Nested sets will not be loaded (any field ending with the _set suffix, with the exception of 'irr_as_set') unless the 'depth'
parameter is passed in the request URL.
Depth can be one of three values:
- 1 : expand sets into ids (slow)
- 2 : expand sets into objects (slower)
Fix typos1 conflicts resolved (#842) * Update 0006_network_allow_ixp_update.py fixes 'Sepcifies' typo in 0006_network_allow_ixp_update.py * Update 0029_auto_20200401_1006.py fixes 'Sepcifies' typo in 0029_auto_20200401_1006.py * Update models.py fixes 'Sepcifies' typo in models.py * Update org_admin_views.py fixes 'afiliation' typos in org_admin_views.py * Update serializers.py fix use of "it's" when it should instead be "its" in 'serializers.py' * Update 0004_geocode_fields.py correct use of "it's" to be "its" in '0004_geocode_fields.py', also fix spelling of 'syncronized' * Update 0029_auto_20200401_1006.py correct use of "it's" to be "its" in '0029_auto_20200401_1006.py', also fix spelling of 'syncronized' * Update models.py correct use of "it's" to be "its" in 'models.py', also fix spelling of 'syncronized' * Update email_confirm.html correct 're-initate' in email_confirm.html * Update notify-pdb-admin-user-affil.txt correct 'organzation' in 'notify-pdb-admin-user-affil.txt' * Update op_create.md correct 'organzation' in 'ip_create.md' * Update notify-pdb-admin-asnauto-skipvq.txt correct 'organzation' in 'notify-pdb-admin-asnauto-skipvq.txt' * Update models.py correct 'organzation' in 'models.py' * Update notify-pdb-admin-asnauto-skipvq.txt fix 'succesfully' in 'notify-pdb-admin-asnauto-skipvq.txt' * Update views.py fix 'succesfully' in 'views.py' * Update pdb_migrate_ixlans.py * Update models.py several more replacements of "it's" with "its" * Update rest.py one more replacement of "it's" with "its" * Update op_retrieve.md replace "dont" with "don't" * Update notify-org-admin-merge.txt fix "dont" with "don't" * Update error.html fix "dont" with "don't" * Update op_list.md fix "dont" with "don't" * Update serializers.py fix "dont" with "don't" * Update deskpro.py fix "dont" with "don't" * Update mock.py fix "dont" with "don't" * Update ixf.py fix "dont" with "don't" * Update admin.py fix "dont" with "don't" * Update api_schema.py fix "dont" with "don't" * Update signals.py fix "dont" with "don't" * Update views.py fix "dont" with "don't" * Update test_admin.py fix "dont" with "don't" * Update pdb_api_test.py fix "dont" with "don't" * Update models.py fix "dont" with "don't" * revert to "IXP" in help text Co-authored-by: Theo Baschak <tbaschak@users.noreply.github.com> Co-authored-by: Stefan Pratter <stefan@20c.com>
2020-09-29 20:01:47 +00:00
- 0 : don't expand sets at all (default behaviour)
**example**
?depth=1
### Cached Responses
Any request that does not require lookups will be served a cached result. Cache is updated approximately every 15 minutes.
You can spot cached responses by checking for the "generated" property inside the "meta" object.
"meta" : {
// the cached data was last regenerated at this time (epoch)
"generated" : 1456121358.6301942
}
**examples**
will serve a cached result:
?depth=2
will serve a live result:
?id__in=1,2
### Resultset limit
Any request that does lookup queries and has it's **depth** parameter specified will have a result limit of 250 entries, any entries past this limit will be truncated, at which point you either should be more specific with your query or use the skip and limit parameters to page through the result set
**examples**
will serve a live result and a maximum of 250 rows at a time:
?updated__gt=2011-01-01&depth=1
will serve a live result and will not be truncated:
?updated__gt=2011-01-01
will serve a cached result and will not be truncated:
?depth=1
### Pagination
Use the skip and limit parameters to page through results
?updated__gt=2011-01-01&depth=1&limit=250 - first page
?updated__gt=2011-01-01&depth=1&limit=250&skip=250 - second page
?updated__gt=2011-01-01&depth=1&limit=250&skip=500 - third page