PagerDuty how to use query parameter in list services? - api

I am sending a request like below:
curl --request GET \
--url 'https://api.pagerduty.com/services?query=my-service-name' \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' \
--header 'Content-Type: application/json'
I was expecting that i can use this to filter the list of services JSON to my service only using query=my-service-name. But this just returns a JSON list of first 25 services. API Guide says:
query(string) - Filters the result, showing only the tags whose labels match the query.
Is there any way to get the details of service just with the service name? Currently i can add a huge limit to the query which will essentially bring all service names and i can get my service from that but that is hardly efficient.
I know i can do GET with service ID, Like below:
curl --request GET \
--url https://api.pagerduty.com/services/SVC_ID \
--header 'Accept: application/vnd.pagerduty+json;version=2' \
--header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' \
--header 'Content-Type: application/json'
but my requirement is to use the service name.

Your question lines up on the time-frame of when PagerDuty broke the query filter for services. Your query looks accurate from my experience.
See:
https://community.pagerduty.com/forum/t/query-filter-is-not-working/3853
Also, while the description of the API says "filters on tags" you'll find it filters on the name of the service first.

Related

How to retrieve warehouse slots with Shippingbo API?

We are using Shippingbo as WMS
I want to retrieve a list of slots for a specific product
So, I tried to request SlotContent: https://app.shippingbo.com/slot_contents?search[product_id__eq]=16794293 but it doesn't work
Is any other solution ?
There is an easy way to do this, you juste have to request the warehouse_slots endpoint
curl --request GET \
--url https://app.shippingbo.com/warehouse_slots?search[product_id__eq][]=21890886 \
--header 'Content-Type: application/json' \
--header 'X-API-TOKEN: ' \
--header 'X-API-USER: ' \
--header 'X-API-USER-ID: ' \
--header 'X-API-VERSION: '

How to alter scripts to pull API data

I am trying to pull data from the below 3rd party API.
curl --request GET \
--url 'https://api.sendgrid.com/v3/messages?limit=1000&query=last_event_time%20BETWEEN%20TIMESTAMP%20%22{start_date}%22%20AND%20TIMESTAMP%20%22{end_date}%22' \
--header 'authorization: Bearer <<your API key>>'
The problem I am having is the API has a max limit of 1000 rows. How could I workaround this as I already have the data filters in place but my expected output is around 30k

Active Collab API - URL Structure Self Hosted

I'm trying to use the Active Collab API to retain project information for reporting purposes. I basically just want to make a daily API call and safe the JSON for further reporting in another tool.
For this reason I don't want to use an SDK or anything, just a plain API call to retain the data.
Can someone please guide me because I couldn't find the correct url structure for a self-hosted system.
I found a solution with the help from the support.
First you have to obtain a token like this:
curl --location --request POST 'https://YOUR.SITE/api/v1/issue-token' \
--header 'Content-Type: application/json' \
--data-raw '{
"username" : "YOUR EMAIL",
"password" : "YOUR PASSWORD",
"client_name" : "xxx",
"client_vendor" : "xxx"
}'
And in the next step you can use the API as documented here by calls like this one:
curl --location --request GET 'https://YOUR.SITE/api/v1/projects' \
--header 'Content-Type: application/json' \
--header 'X-Angie-AuthApiToken: YOUR TOKEN'

Using cURL in API where a Date Array is required

I'm trying to create a simple cURL request to grab some JSON data and dump it into a file. Tried using command-line and PowerShell but can't
figure out how to use a date array as required in the documentation (https://api.officevibe.com/docs/engagement)
The support at OfficeVibe is ridiculous, unless you know exactly what you're doing they're not very willing to help and any examples provided don't actually work (as i'm assuming they need to be part of a larger app).
Can anyone offer some advice on how i can get this working? (The Bearer ID isn't our actual ID)
Example from OfficeVibe which doesn't work in command-line or PowerShell:
c:\temp\curl.exe -k -X POST https://app.officevibe.com/api/v2/engagement -H 'Authorization: Bearer 1234' -H 'Content-Type: application/json' -d '{"dates" : ["2019-04-01"]}' -o c:\temp\engagement.json
Many thanks
The answer was as easy - all i needed to do was add a backslash before the double-quote:
c:\temp\curl.exe -k -X POST https://app.officevibe.com/api/v2/engagement -H 'Authorization: Bearer 1234' -H 'Content-Type: application/json' -d '{\"dates\" : [\"2019-04-01\"]}'

Download exact email data using bounced from API call

How can I get all the data from the bounced emails using API call.
When I use my API call to get data, I only retrieve first 500 records using curl, Can it be possible to get all the data and download in a file.
The command which I am using is as below ... I tried to increase limit of the API call with 501 below was the error ? Can any one let me know how to resolve ?
curl --request GET \
--url https://${API_CALL} \
--header 'accept: application/json' \
--header 'authorization: Bearer ${AUTH_TOKEN}' \
curl --request GET \
--url https://${API_CALL}?limit=501 \
--header 'accept: application/json' \
--header 'authorization: Bearer ${AUTH_TOKEN}' \
{"errors":[{"field":"limit","message":"must be between 0 and 500"}]}