Questions about Cloud + GraphDB - sparql

I'm working on a project and i need a triple-store database in cloud, which support SPARQL queries.
GraphDB looks good and works fine in my desktop computer (localhost). But, when I try to use it in the cloud (CloudDB), REST requisitions doesn't work.
Problem: I'm trying to query my repository using REST, by curl -X GET --header 'Accept: application/sparql-results+xml'.
Repository ID: hermesiot
Query: select * where {?s ?p ?o .} limit 100
Results:
Response Code: 404
Response Body: {"message":"Database not found."}
How to deploy GraphDB in cloud solutions, like Azure or another free solutions?
Many thanks :)

According to the official example, your query should be of this kind:
curl --header 'Accept: application/sparql-results+xml' \
--data "query=SELECT+*+{?s+?p+?o.}" \
--user s472kd733007:bhrfk1aa8o0qlj7 \
'https://rdf.s4.ontotext.com/4032537848/wikidata/repositories/fast'
However, the query above does not work for me, whereas the query below does:
curl --header 'Accept: application/sparql-results+xml' \
--data "query=SELECT+*+{?s+?p+?o.}" \
--user s472kd733007:bhrfk1aa8o0qlj7 \
'http://awseb-e-m-awsebloa-11laimnu18r2i-2106042490.eu-west-1.elb.amazonaws.com/4032537848/wikidata/repositories/fast'
In the queries above:
s472kd733007 — API key,
bhrfk1aa8o0qlj7— API key secret,
4032537848 — user id
wikidata — database name,
fast — repository id,
http://awseb-e-m-awsebloa-...eu-west-1.elb.amazonaws.com — AWS instance address.
Visit tabs in your dashboard in order to obtain applicable values of these parameters.
As for update queries, see e. g. this answer. Your query should be:
curl --header 'Accept: application/sparql-results+xml' \
--data "update=INSERT+DATA+{owl:Nothing+owl:Nothing+owl:Nothing}" \
--user s472kd733007:bhrfk1aa8o0qlj7 \
'http://awseb-e-m-awsebloa-11laimnu18r2i-2106042490.eu-west-1.elb.amazonaws.com/4032537848/wikidata/repositories/fast/statements'
Please note that endpoint address in this request is different.

Related

PagerDuty how to use query parameter in list services?

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.

Rundeck : How to check Rundeck health status?

We have a few jobs in production rundeck, due to other application running and throttling CPU, rundeck sometimes goes slow and lag sometimes nearly dead but rundeckd process will be still running. I wanted to set up cron(which I know) to query rundeck healthcheck and report if its sluggish till we migrate rundeck to dedicated VM. I found rundeck3.3 has api enabled by default and I am able to query in browser like http://rundesckhost:4440/metrics/ping which will return pong. Apparently http://rundeckhost:4440/metrics/healthcheck shows json
{"dataSource.connection.time":{"healthy":true,"message":"Datasource connection healthy with timeout 5 seconds"},"quartz.scheduler.threadPool":{"healthy":true}}
I have generated API token of admin user for authentication in scripting purpose. All I wanted to know how to use API to curl with token to get the result ? I tried following but couldn't get the required result.
curl --location --request GET 'http://rundeckhost:4440/metrics/ping' \
--header 'Accept: application/json' \
--header 'X-Rundeck-Auth-Token: <generated token here>'
My ENV spec:
OS : Centos 8 |
Java : 8 |
Rundeck: 3.3 community edition |
Scripting Language : curl, bash
Your ping API call is wrong, with the following call it works:
curl --location --request GET 'http://rundeckhost:4440/api/35/metrics/ping' \
--header 'Accept: application/json' \
--header 'X-Rundeck-Auth-Token: <your-token-here>'
Just in case, also you can use RD CLI tool for that, with the command:
$ rd metrics ping
Result:
# [2020-07-31T09:09:37.200] Pinging server...
# [2020-07-31T09:09:37.503] pong
More insight answer to my own question :
if anyone is having issues in using URL http://rundeckhost:4440/api/35/metrics/ping then it would be wrong api version which could be different for different versions of rundeck. so you can find out the right version by accessing your own rundeck http://rundeckhostIP:4440/api/ which will show up xml with api version in it as follows:
Use that version number in the querying URL in which in my case its 35.

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

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\"]}'

Unable to call Azure Management Events REST API

I am trying to use the rest api found here: https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx to get the azure events from my subscription. I have followed the instructions very carefully, but my GET requests return a 400 error:
{"Code":"BadRequest","Message":"The $filter query parameter value is invalid."}
My cURL request can be seen below. I've redacted any private info
curl -X GET -H "Authorization: bearer XXX" -H "content-type: application/json" "https://management.azure.com/subscriptions/YYY/providers/microsoft.insights/eventtypes/management/values?api-version=2014-04-01&$filter=eventTimestamp%20ge%20%272016-07-25T22:00:37Z%27%20and%20eventTimestamp%20le%20%272016-07-25T23:36:37Z%27%20and%20eventChannels%20eq%20%27Admin,%20Operation%27"
I have tried many variations of the filter param, but I think this should be correct. Each space was replaced with a %20, and each ' was replaced with a %27.
If anyone can please inform me as to what the correct query should look like i'd really appreciate it!
Thanks!
Please try to change the double quotes over the url to the single quotes. And it works fine on my side after modification.
E.G.,
curl -X GET -H 'Authorization: bearer <token>' -H 'content-type: application/json' 'https://management.azure.com/subscriptions/XXX/providers/microsoft.insights/eventtypes/management/values?api-version=2014-04-01&$filter=eventTimestamp%20ge%20%272016-07-25T22:00:37Z%27%20and%20eventTimestamp%20le%20%272016-07-25T23:36:37Z%27%20and%20eventChannels%20eq%20%27Admin,%20Operation%27'