-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from rbw/feature/docs-usage-filtering
Add field filter usage example
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Filtering fields | ||
================ | ||
|
||
The `fields` parameter can be used for selecting which fields to return in the response. | ||
|
||
|
||
.. code-block:: python | ||
import pysnow | ||
# Create client object | ||
c = pysnow.Client(instance='myinstance', user='myusername', password='mypassword') | ||
# Define a resource, here we'll use the incident table API | ||
incident = c.resource(api_path='/table/incident') | ||
# Query for incidents with state 3 | ||
response = incident.get(query={'state': 3}, fields=['sys_id', 'number', 'description']) | ||
# Print out the first match | ||
print(response.first()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters