We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to make a query to a custom API name in our servicenow instance like the following:
https://$COMPANY.service-now.com/api/now/on_call_rota/current?group_name=$GROUPNAME
However, am getting back empty responses or exceptions. I've tried the following methods:
import pysnow snow = pysnow.client.Client(instance="$COMPANY", user="$USER", password="$PASSWORD") oncall = snow.resource(api_path="/on_call_rota/current") response = oncall.get(query={"group_name": "$GROUPNAME"}) response.all()
Which results in a 200, but the result is empty.
import pysnow snow = pysnow.client.Client(instance="$COMPANY", user="$USER", password="$PASSWORD") oncall = snow.resource(api_path="/on_call_rota/current") oncall.request("GET", path_append="?group_name=$GROUPNAME"
which results in an exception:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/$USER/projects/.venv/lib/python3.8/site-packages/pysnow/resource.py", line 162, in request return self._request.custom( File "/home/$USER/projects/.venv/lib/python3.8/site-packages/pysnow/request.py", line 167, in custom self._url = self._get_custom_endpoint(path_append) File "/home/$USER/projects/.venv/lib/python3.8/site-packages/pysnow/request.py", line 83, in _get_custom_endpoint return self._url_builder.get_appended_custom(segment) File "/home/$USER/projects/.venv/lib/python3.8/site-packages/pysnow/url_builder.py", line 59, in get_appended_custom self.validate_path(path_component) File "/home/$USER/projects/.venv/lib/python3.8/site-packages/pysnow/url_builder.py", line 31, in validate_path raise InvalidUsage( pysnow.exceptions.InvalidUsage: Path validation failed - Expected: '/<component>[/component], got: /?group_name=$GROUPNAME
How can I do this query?
The text was updated successfully, but these errors were encountered:
Ok, I might have figured out my own question. This seems to work:
import pysnow snow = pysnow.client.Client(instance="$COMPANY", user="$USER", password="$PASSWORD") response = snow.session.get(f"{snow.base_url}/api/now/on_call_rota/current?group_name=$GROUPNAME") response.json()
However, my question then becomes is the best way to handle this?
Sorry, something went wrong.
No branches or pull requests
I am trying to make a query to a custom API name in our servicenow instance like the following:
https://$COMPANY.service-now.com/api/now/on_call_rota/current?group_name=$GROUPNAME
However, am getting back empty responses or exceptions. I've tried the following methods:
Which results in a 200, but the result is empty.
which results in an exception:
How can I do this query?
The text was updated successfully, but these errors were encountered: