I have recently just started experimenting with the Hydra Console. Looks to me as it is broken.
If you navigate to the public version: http://www.markus-lanthaler.com/hydra/console/#
and enter this URL: http://kadebom.com/EntryPoint.jsonld (which is an exact copy of the example, except on my server)
it just returns "#context": and doesn't have any values present.
Please see the screenshot:
There are no errors in the JS console. I tried changing my Apache config to Access-Control-Allow-Origin: * but to no avail.
Could someone please tell me what I am doing wrong?
Your document doesn't seem to be an exact copy (anymore, I assume after reading your own answer). Put an exact copy of the example there and make sure to serve it with the right content type, i.e., Content-Type: application/ld+json.
If you want the documentation on the right hand side to show up as well, you also need to reference the ApiDocumentation from a Link header as the example does (do a curl -i http://www.markus-lanthaler.com/hydra/api-demo/contexts/EntryPoint.jsonld to see how the demo does it.
Btw. I would suggest you to look at the Event API Demo instead.
For some reason, unspecified in any documentation, and please, if there is some, please provide it, my json document had to be:
{
"#context": {
"__value": "/hydra/api-demo/contexts/EntryPoint.jsonld",
"__activectx": {
"#base": {},
"hydra": {
"#id": "http://www.w3.org/ns/hydra/core#",
"#reverse": false
},
"vocab": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#",
"#reverse": false
},
"EntryPoint": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint",
"#reverse": false
},
"issues": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/issues",
"#reverse": false,
"#type": "#id"
},
"register_user": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/registerUser",
"#reverse": false,
"#type": "#id"
},
"my_account": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/myAccount",
"#reverse": false,
"#type": "#id"
},
"users": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/users",
"#reverse": false,
"#type": "#id"
}
}
},
"#id": {
"__iri": "#id",
"__value": {
"__orig_value": "/hydra/api-demo/",
"__value": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/"
}
}
},
"#type": {
"__iri": "#type",
"__value": {
"__orig_value": "EntryPoint",
"__value": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint"
}
}
},
"issues": {
"__iri": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/issues",
"__value": {
"__orig_value": "/hydra/api-demo/issues/",
"__value": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/issues/"
}
}
},
"register_user": {
"__iri": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/registerUser",
"__value": {
"__orig_value": "/hydra/api-demo/users/",
"__value": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/users/"
}
}
},
"users": {
"__iri": "http://www.markus-lanthaler.com/hydra/api-demo/vocab#EntryPoint/users",
"__value": {
"__orig_value": "/hydra/api-demo/users/",
"__value": {
"#id": "http://www.markus-lanthaler.com/hydra/api-demo/users/"
}
}
}
}
rather than what will be downloaded if you go to this url:
http://www.markus-lanthaler.com/hydra/event-api/
Related
I uploaded some json to my graphql using gatsby-transformer-json and gatsby-source-filesystem.
I would like to request an object of that data, which contains subfields.
When I try to make this request, I receive the error
Field \"sections\" of type \"DataJsonSections\" must have a selection of subfields. Did you mean \"sections { ... }\"?
Below is my json file. I am trying to request the section called "Sections". I would really like to find a way, so that I don't have to specify spiel and abbr for every section.
My json file
{
"slogan": "some slogan",
"drawIn": "Something to draw people in",
"fullName": "My full title",
"shortName": "My title",
"metadata": {
"desc": "...........",
"title": "............"
},
"sections": {
"about": {
"spiel": "..........."
},
"web-design": {
"abbr": "Websites",
"spiel": ".............."
},
"app-design": {
"abbr": "Apps",
"spiel": "..........."
},
"seo": {
"spiel": ".........."
},
"contact": {
"title": "Contact",
"subtitle": "Contact subtitle",
}
}
}
This is the request I would like to make, but I receive the error above when I do
query MyQuery {
allDataJson {
edges {
node {
sections
}
}
}
}
Extra
Within my gatsby-config.js(This is how I'm using gatsby-transformer-json and gatsby-source-filesystem)
`gatsby-transformer-json`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `data`,
path: `${__dirname}/src/data`
}
},
Field "sections" of type "DataJsonSections" must have a selection of subfields
I have custom skill that calls web service i created. I am able to launch and get other intent, but i am not getting notification when permission for notification is changed by user of my skill. I need he notification event to get user id for sending push notifications later by other service.
Below is my json file:
{
"manifest": {
"apis": {
"custom": {
"endpoint": {
"uri": "https://pathToMyService",
"sslCertificateType": "Wildcard"
},
"interfaces": []
}
},
"events": {
"publications": [
{ "eventName": "AMAZON.TrashCollectionAlert.Activated" },
{ "eventName": "AMAZON.MessageAlert.Activated" }
],
"subscriptions": [
{ "eventName": "SKILL_PROACTIVE_SUBSCRIPTION_CHANGED" },
{ "eventName": "SKILL_ENABLED" },
{ "eventName": "SKILL_DISABLED" },
{ "eventName": "SKILL_PERMISSION_ACCEPTED" },
{ "eventName": "SKILL_PERMISSION_CHANGED" },
],
"regions": {
"NA": {
"endpoint": {
"uri": "https://pathToMyService",
"sslCertificateType": "Wildcard"
}
}
},
"endpoint": {
"uri": "https://pathToMyService",
"sslCertificateType": "Wildcard"
}
},
"manifestVersion": "1.0",
"permissions": [
{ "name": "alexa::devices:all:notifications:write" }
],
"publishingInformation": {
"locales": {
"en-US": { "name": "Test Events" }
}
}
}
}
Below is the Launch request: I have truncated applicatioId, userID, consentToken, deviceId, apiAccessToken
{"version":"1.0","session":{"new":true,"sessionId":"amzn1.echo-api.session.60ad1e76-0872-4e10-b79d-7144cdf3e1c9","application":{"applicationId":"amzn1.ask.skill.59d60703"},"user":{"userId":"amzn1.ask.account.AGB7EOY","permissions":{"consentToken":"eyJ0eXAiOiJKV1"}}},"context":{"System":{"application":{"applicationId":"amzn1.ask.skill.59d60703"},"user":{"userId":"amzn1.ask.account.AGB7EOY","permissions":{"consentToken":"eyJ0eXAiOiJKV1Qi"}},"device":{"deviceId":"amzn1.ask.device.AFNXDZOAEMFDFKK","supportedInterfaces":{}},"apiEndpoint":"https://api.amazonalexa.com","apiAccessToken":"eyJ0eXAiOiJKV1Qi"}},"request":{"type":"LaunchRequest","requestId":"amzn1.echo-api.request.adb318af-1977-4b36-b8ad-0bb4352fa563","timestamp":"2020-03-22T23:37:55Z","locale":"en-US","shouldLinkResultBeReturned":false}}
Thanks
I resolved the issue: When I updated by skill.json file using
ask api update-skill -s amzn1.ask.skill.59d6 -f Test.json
it didn't update properly. I noticed today when I got latest
ask api get-skill -s amzn1.ask.skill.59d6 >Test2.json
the event section was missing. I added back and reapplied and it's working now.
I am trying to add registrationConfig for my CA certificate in AWS IoT. I would like to do some manipulation of data for Thing attributes. But I can't seem to get that JITP to work if the template body has Fn::Join in it.
Following are extract of the template body (string unescaped for reading purpose)
NOT working:
"Resources": {
"thing": {
"Type": "AWS::IoT::Thing",
"Properties": {
"ThingName": {
"Ref": "AWS::IoT::Certificate::CommonName"
},
"ThingTypeName" : "w2-device",
"ThingGroups" : ["w2-devices"],
"AttributePayload": {
"location": {
"Fn::Join":["",["ThingPrefix_",{"Ref":"SerialNumber"}]]
},
"organization": {
"Ref": "AWS::IoT::Certificate::Organization"
},
"version": "w2",
"country": {
"Ref": "AWS::IoT::Certificate::Country"
}
}
}
},
In the above when I have Fn::Join in AttributePayload/location it fails to create the Thing during JITP. I don't see any errors in CloudWatch either.
Working:
"Resources": {
"thing": {
"Type": "AWS::IoT::Thing",
"Properties": {
"ThingName": {
"Ref": "AWS::IoT::Certificate::CommonName"
},
"ThingTypeName" : "w2-device",
"ThingGroups" : ["w2-devices"],
"AttributePayload": {
"location": {
"Ref": "AWS::IoT::Certificate::StateName"
},
"organization": {
"Ref": "AWS::IoT::Certificate::Organization"
},
"version": "w2",
"country": {
"Ref": "AWS::IoT::Certificate::Country"
}
}
}
},
Note: I have also asked this in aws forum but without any answer there yet.
Provisioning templates for JITP define a set of parameters beginning with AWS::IoT::Certificate.
The AWS::IoT::Certificate::SerialNumber parameter should be used instead of just SerialNumber in the attribute payload. e.g.
"AttributePayload": {
"location": {
"Fn::Join":["",["ThingPrefix_",{"Ref":"AWS::IoT::Certificate::SerialNumber"}]]
},
https://docs.aws.amazon.com/iot/latest/developerguide/jit-provisioning.html lists the defined parameters for JITP as:
AWS::IoT::Certificate::Country
AWS::IoT::Certificate::Organization
AWS::IoT::Certificate::OrganizationalUnit
AWS::IoT::Certificate::DistinguishedNameQualifier
AWS::IoT::Certificate::StateName
AWS::IoT::Certificate::CommonName
AWS::IoT::Certificate::SerialNumber
AWS::IoT::Certificate::Id
The SerialNumber examples in the AWS documentation (without the AWS::IoT::Certificate prefix are used for the Bulk Registration process.
I am trying to use graphQL in a GatsbyJS project, and am unsure how I can pull a specific 'URL' object, from a list of three, within a 'recipeImages' object. Right now, I can only pull the recipeImages object, like this:
<img src={node.recipeImages}/>
but I want to be able to get to the three individual URL objects seen in this query:
{
"data": {
"allContentfulBlogPost": {
"edges": [
{
"node": {
"id": "c1Qz3hWuPuQEIIUkSos0MEO",
"postTitle": "Schwarzwälder Kirschtorte",
"postDate": "2018-01-30T00:00+01:00",
"slug": "schwarzwälder-kirschtorte",
"methodText": {
"childMarkdownRemark": {
"html": "<p>This is the method text</p>"
}
},
"recipeImages": [
{
"title": "imageOne",
"file": {
"url": "//images.contentful.com/62o0h4ehxjxr/kkc57vWLPaEakYueyYqC6/c61b4641797a2fcaf3476ef9a3a24db6/image.jpg"
}
},
{
"title": "imageTwo",
"file": {
"url": "//images.contentful.com/62o0h4ehxjxr/2ifxQEvnYwkaAe6e2YKISa/de2b6f62c4cac3b501fe76146b745790/image1.jpg"
}
},
{
"title": "imageThree",
"file": {
"url": "//images.contentful.com/62o0h4ehxjxr/17g7ZHqrEWIgcyuye08myG/6b55386a31db2dd319148795953da7a4/image2.jpg"
}
}
]
}
}
]
}
}
}
i got it:
<img src={recipeImages[0].responsiveResolution.src}/>
I am working on search as you type functionality with angularjs and elastic search.I am passing the $viewValue to factory written in angular and it fetches data from angular.Please check code below.
services.factory('instantSearch',['$q', 'esFactory', '$location', function($q, elasticsearch, $location){
return{
instantResult : function(term){
var client = elasticsearch({
// host: $location.host() + ':9200'
host: 'localhost:9200'
});
var deferred = $q.defer();
client.search({
"index": 'stocks',
"type": 'stock',
"body": {
"from" : 0, "size" : 20,
"query": {
"bool":{
"should":[
{
"match_phrase":{
"name": term
}
},
{
"match_phrase":{
"symbol": term
}
},
{
"match":{
"industry": term
}
}
]
}
}
}
}).then(function(result) {
var hits = result.hits.hits;
deferred.resolve(hits);
},
function (err) {
console.trace(err.message);
}, deferred.reject);
return deferred.promise;
}
};
}]);
This code is working fine but the problem is that I get result when input matches complete term in elasticsearch index's field.So I want to implement token analyzer which will match token(ngram - 1,2,3) and provide result on typing of each character.
So to add analyzer code we have to add settings in te elasticserach index as below:
"settings": {
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
But I am not getting the way to pass the argument here.Every example I checked shows output with curl command.How can we mix analyzer with the working code above.
Thanks for help.
Have you added the analyzer to the fields name, symbol and industry in your elastic search mapping?
curl -XPUT 'http://localhost:9200/index/type/_mapping?ignore_conflicts=true' -d'
{
"type": {
"properties": {
"name": {
"type": "string",
"analyzer": "autocomplete"
}
}
}
}'
Use ignore_conflicts=true without fail.
If you still face issues, then you might have to create a new index, add analyzer and filter to setting, create the desired mapping and then upload the data again.