I am a student and I'm learning to use sparql. I would like to query an endpoint by running the sparql query from GRAPHDB.
So looking online I found that the solution is to use SERVICE with the endpoint link.
I have tried with the wikidata endpoint on GRAPHDB but the query result is empty.
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT
?partyLabel
WHERE {
SERVICE <https://query.wikidata.org/bigdata/namespace/categories/sparql> {
?party wdt:P31 wd:Q7278;
wdt:P17 wd:Q38.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
LIMIT 5
However, the same query (without SERVICE) works on https://query.wikidata.org.
SELECT DISTINCT
?partyLabel
WHERE {
?party wdt:P31 wd:Q7278;
wdt:P17 wd:Q38.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 5
Surely I didn't understand how SERVICE works or something else, could you help me out?
Thank you in advance
Related
I'm running this request through Postman. Some posts to the Shopify developer forum (e.g., this one) express without clear explanation that the request should be made within the Shopify app that would be subscribing to the Webhooks, but Postman seems to work, too.
In Postman . . .
Here's the endpoint:
https://{{shopifyDevelopmentStoreName}}.myshopify.com/admin/api/2022-07/graphql.json
Here's the GraphQL body:
mutation createWebhookSubscription($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {
eventBridgeWebhookSubscriptionCreate(
topic: $topic,
webhookSubscription: $webhookSubscription
) {
webhookSubscription {
id
}
userErrors {
message
}
}
}
Here's the payload being sent (notice the "client_id_x" value within the arn property):
{
"topic": "PRODUCTS_CREATE",
"webhookSubscription": {
"arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/client_id_x/LovecraftEventBridgeSource",
"format": "JSON",
"includeFields": "id"
}
}
Here's the response I receive:
{
"data": {
"eventBridgeWebhookSubscriptionCreate": {
"webhookSubscription": null,
"userErrors": [
{
"message": "Address is invalid"
},
{
"message": "Address is an AWS ARN and includes api_client_id 'client_id_x' instead of 'client_id_y'"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
What's entirely unclear is why Shopify is insisting upon validity of "client_id_y" when, in AWS, the value being displayed is undeniably 'client_id_x'. Extremely confusing. I don't even see what difference using the Shopify app would make except that it produces a client_id value that works counter to one's expectations and intuitions.
Does anyone know why the heck Shopify isn't just using the client_id value of the event bus created earlier in Amazon EventBridge?
Same happend to me and I was lucky to find a solution.
The error message is just missleading.
I replaced the API Access Token for the Shopify Rest API Request (X-Shopify-Access-Token)
with the one from the Shopify App holding the aws credentials.
admin/settings/apps/development -> app -> API credentials -> Admin API access token. (can only be seen after creation)
Then I could subscribe webhooks to the app via the Rest Interface.
I need to create an openrdf:SailRepository in which to authenticate with basic authentication with username and password to a service. I tried the following configuration of the repository, but I don't know how to set the username and password to connect to the service.
PREFIX repo: <http://www.openrdf.org/config/repository#>
PREFIX reposail: <http://www.openrdf.org/config/repository/sail#>
PREFIX ephedra: <http://www.metaphacts.com/ontologies/platform/ephedra#>
PREFIX sail: <http://www.openrdf.org/config/sail#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.metaphacts.com/ontologies/platform/service/custom#>
[] a repo:Repository ;
repo:repositoryID "rest-api-wrapper" ;
rdfs:label "Repository to connect to a remote REST API." ;
repo:repositoryImpl [
repo:repositoryType "openrdf:SailRepository" ;
reposail:sailImpl [
sail:sailType "metaphacts:RESTService" ;
ephedra:serviceURL "http://example.org/rest/service/api" ;
ephedra:httpMethod "POST" ;
ephedra:httpHeader [
ephedra:name "Authorization";
ephedra:value "Basic Auth"
] ;
ephedra:implementsService ephedra:service-name
]
] .
I looked over the documentation on hhttps://rdf4j.org/documentation/reference/configuration/#SailRepository but I don't find any example with the basic authorization concept. Also I need to be able to also configure the body of the POST request. How could I change the template above to add the username, password and the body parameters of the request?
I created an API using the following code:
["/environments/:env-name/nodes"
{:swagger {:tags ["Nodes"]}
:parameters {:path {:env-name ::vt-vali/name}}}
[""
{:get {:summary "Retrieve the nodes from this environment"
:parameters {:query {:date ::vt-vali/timestamp}}
:responses {200 {:body map?}}
:handler (fn [{{{:keys [env-name]} :path
{:keys [date]} :query} :parameters}]
(let [result (vt-data/ret-nodes env-name date)]
(if (s/valid? map? result)
{:status 200
:body result}
{:status 500
:body result})))}}]]
This works perfectly. However, I want to make the query parameter optional.
Can anyone help me with this?
I found an answer by searching through the examples in metosin/reitit.
It is possible to use clojure.spec.alpha. Add [clojure.spec.alpha :as s] to the required dependencies of the namespace and you can use:
:parameters {:query (s/keys :opt-un [::date])}
See this file for the example in metosin/reitit http-swagger example
I don't think that can be done. You can add an extra route:
(defn handler [{{{:keys [env-name]} :path
{:keys [date]} :query} :parameters}]
(let [result (vt-data/ret-nodes env-name date)]
(if (s/valid? map? result)
{:status 200
:body result}
{:status 500
:body result})))
["/environments/nodes"
{:swagger {:tags ["Nodes"]}
:parameters {:path {:env-name ::vt-vali/name}}}
[""
{:get {:summary "Retrieve the nodes from this environment"
:parameters {:query {:date ::vt-vali/timestamp}}
:responses {200 {:body map?}}
:handler handler}}]
"/environments/:env-name/nodes"
{:swagger {:tags ["Nodes"]}
:parameters {:path {:env-name ::vt-vali/name}}}
[""
{:get {:summary "Retrieve the nodes from this environment"
:parameters {:query {:date ::vt-vali/timestamp}}
:responses {200 {:body map?}}
:handler handler}}]]
I want to make gallery on my website with photo from Instagram.
Just show my photos. How can I do this without some request like:
<_a_ href="https://api.instagram.com/oauth/authorize/?client_id=<?php echo clientID; ?>&redirect_uri=<?php echo redirectURI; ?>&response_type=code">LOGIN<_a_>
Can I define access_token for this request?
$url = 'https://api.instagram.com/v1/users/' . $userID . '/media/recent/?access_token=' . $access_token . '&count=50';
I'm using the BFM service in the SABRE REST API. Im trying get only direct flights (Non Stops Flights) using the objects: TPA_Extensions.DiversityParameters.AdditionalNonStopsPercentage
TravelPreferences.FlightTypePref.FlightType
but the answers allways is: 400 Bad Request
{
"status": "NotProcessed",
"type": "Validation",
"errorCode": "ERR.RAF.VALIDATION",
"timeStamp": "2016-02-10T14:24:13+00:00",
"message": "[{\"level\":\"error\",\"schema\":{\"loadingURI\":\"#\",\"pointer\":\"/definitions/org.opentravel.ota._2003._05.OTAAirLowFareSearchRQ.TPAExtensions\"},\"instance\":{\"pointer\":\"/OTA_AirLowFareSearchRQ/TPA_Extensions\"},\"domain\":\"validation\",\"keyword\":\"additionalProperties\",\"message\":\"object instance has properties which are not allowed by the schema: [\\\"DiversityParameters\\\"]\",\"unwanted\":[\"DiversityParameters\"]}]"
}
There are somebody had the same issue?
thanx in advance
If you want to add nonnumstop you must add to OTA_AirLowFareSearchRQ as in the xml below:
<PriceRequestInformation xmlns="http://webservices.sabre.com/sabreXML/2011/10">
<OptionalQualifiers>
<FlightQualifiers NumStops="0" />
<PricingQualifiers CurrencyCode="VND">
<PassengerType Code="ADT" Quantity="1" />
</PricingQualifiers>
</OptionalQualifiers>
Try this
"DiversityParameters" : {
"AdditionalNonStopsPercentage" : 20
}
or
"DiversityParameters" : {
"AdditionalNonStopsNumber" : 5
}
This code works balancing the BFM results.