Following up on this question, I don't understand why I can't get what I look for: the image of a Wikipedia Article, that of Le Monde.
This request gives me the claims I expect:
https://www.wikidata.org/w/api.php?action=wbgetclaims&entity=Q12461&property=P154
{
"claims": {
"P154": [
{
"mainsnak": {
"snaktype": "value",
"property": "P154",
"hash": "5566a330c25e15b3997363b88367fbf3e2fda8b1",
"datavalue": {
"value": "Le Monde.svg",
"type": "string"
},
"datatype": "commonsMedia"
},
"type": "statement",
"id": "q12461$FFF271FE-B26C-4A90-B787-9115024C7F21",
"rank": "normal"
}
]
}
}
With http://www.md5.cz/ I can get the md5 checksum of Le Monde.svg which is 92c8a6c9e4755bd38fb7b9c8ac8fcdb6
However, https://upload.wikimedia.org/wikipedia/commons/9/92/Le%20Monde.svg returns an error:
File not found: /v1/AUTH_mw/wikipedia-commons-local-public.92/9/92/Le%20Monde.svg.svg
Any idea what I'm doing wrong here?
Related
i've created online facebook store and catalog but for some reason I'm unable sending single product interactive message.
Anyone can help me understand what am i missing?
endpoint https://graph.facebook.com/v13.0/MY_ID/messages
request:
{
"messaging_product": "whatsapp",
"to": "xxxxxxx",
"recipient_type": "individual",
"type": "interactive",
"interactive": {
"type": "product",
"body": {
"text": "text-body-content"
},
"footer": {
"text": "text-footer-content"
},
"action": {
"catalog_id": "zzzzzz",
"product_retailer_id": "wwww"
}
}
}
response:
{
"error": {
"message": "(#131009) Parameter value is not valid",
"type": "OAuthException",
"code": 131009,
"error_data": {
"messaging_product": "whatsapp",
"details": "Interactive Message type, 'product' not supported. Supported types ['button', 'list']"
},
"error_subcode": 2494010,
"fbtrace_id": "AFhn57y_es2_yWcQpsm6c2S"
}
}
My team is building a health app and thus using Asymmetrik FHIR API Server. We need to save a bundle consisting of Condition, Observation and Procedure. The bundle should create each individual object in their respective tables. But when we are using postman to hit the base URL with a very simple bundle object it is giving Invalid URL. Each service is individually working fine and able to create respective objects. How can we enable the root URL of this FHIR server?
POST URL: http://localhost:3000/4_0_0/
POST Object:
{
"resourceType": "Bundle",
"id": "f001",
"type": "transaction",
"entry": [
{
"resource": {
"resourceType": "Observation",
"status": "registered"
},
"request": {
"method": "POST",
"url": "Observation"
}
},
{
"resource": {
"resourceType": "Condition",
"code": {
"coding": {
"system": "http://hl7.org/fhir/ValueSet/condition-code",
"code": "",
"display": ""
}
}
},
"request": {
"method": "POST",
"url": "Condition"
}
}
]
}
ERROR:
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "not-found",
"details": {
"text": "Invalid url: /4_0_0/"
}
}
]
}
I am trying to upload my intent everything is working fine, i am writing script in V2 and everything works but for parameter webhookState data type is enum ( [here] ) and we have to enter following of the three values ( [here][1]) now when i enter any one and try to upload it shows.
" Unable to load file: SyntaxError: Unexpected token W in JSON at position 98 "
now when I pass WEBHOOK_STATE_ENABLED(or any one) in quotes code uploads successfully (because as per my knowledge it treats it as string and gets executed) and intent is created for my agent but webhook remains off and also training phrases are not there, i am certain that the parameter webhookState is not being activated when i pass in quotes(because of above mentioned reason) Same is the case with rest, like when i try to put in type of training phrases.
{
"name": "Warehouse_Management",
"displayName": "Warehouse_Management",
"webhookState": "WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING" ,
"priority": 50000,
"isFallback": false,
"mlDisabled": false,
"trainingPhrases": [
{
"name":"Try1" ,
"type": "EXAMPLE",
"parts": [
{
"text": "for",
"userDefined": true
},
{
"text": "warehouse",
"entityType": "#Properties",
"alias": "Properties",
"userDefined": true
},
{
"text": "management",
"userDefined": true
}
]
},
{
"name":"Try2" ,
"type": "EXAMPLE",
"parts": [
{
"text": "i want app for ",
"userDefined": true
},
{
"text": "warehouse",
"alias": "Properties",
"entityType": "#Properties",
"userDefined": true
}
]
}
],
"outputContexts": [
{
"name": "Yes",
"lifespanCount": 2
},
{
"name": "No",
"lifespanCount": 2
},
{
"name": "Device_Integration",
"lifespanCount": 2
}
],
"resetContexts": false,
"parameters": [
{
"name": "Properties",
"displayName": "Properties",
"value": "$parameter_name",
"entityTypeDisplayName": "#Properties",
"mandatory": false,
"isList": true
}
],
"messages": [
{
"text":"This is sample response"
}
],
"rootFollowupIntentName": "root",
"parentFollowupIntentName": "parent"
}
Please NOTE that in the attached Json i have put it in quotes so it would get successfully executed and will create intent.
In order for it to be valid JSON, the enum value should be wrapped in quotes. It's expecting the enum value as a String.
Question:
Is there a plain or native javascript way to validate a JSON script against a JSON schema?
I have found lots of libraries on Github, but no native/plain solution. Does EcmaScript not have a specification for this? and do none of the browsers (or nodejs) have a way to validate JSON natively?
Context of Question:
I have a very complex schema that I developed.
It is supposed to work along with a script that requires that the JSON data passed into it to comply with the schema.
Simply, no.
There was something called JSON Schema, which was an Internet Draft which expired in 2013. Internet Drafts are the first stage to producing an Internet Standard. See more about it at the official site, as it seems to potentially still be actively developed, although it is not (to my knowledge) in widespread use.
An example of the schema:
{
"$schema": "http://json-schema.org/schema#",
"title": "Product",
"type": "object",
"required": ["id", "name", "price"],
"properties": {
"id": {
"type": "number",
"description": "Product identifier"
},
"name": {
"type": "string",
"description": "Name of the product"
},
"price": {
"type": "number",
"minimum": 0
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"stock": {
"type": "object",
"properties": {
"warehouse": {
"type": "number"
},
"retail": {
"type": "number"
}
}
}
}
}
will validate this example JSON:
{
"id": 1,
"name": "Foo",
"price": 123,
"tags": [
"Bar",
"Eek"
],
"stock": {
"warehouse": 300,
"retail": 20
}
}
There seems to be at least one pure JS solution now (https://github.com/tdegrunt/jsonschema) available via npm (https://www.npmjs.com/package/jsonschema). I am not a contributor, although I appreciate their work.
I've written an ESB resource which takes in a list of test cases, like the example below:
{
"tests": [
{ "type": "DSS", "url": "http://localhost:8280/testsuite/general/test" },
{ "type": "ESB", "url": "http://localhost:8280/testsuite/general/test" },
{ "type": "GREG", "url": "http://localhost:8280/testsuite/general/test" },
{ "type": "GW", "url": "http://localhost:8280/testsuite/general/test" },
{ "type": "MB", "url": "http://localhost:8280/testsuite/general/test" },
{ "type": "ID", "url": "http://localhost:8280/testsuite/general/test" },
{ "type": "BOGUS", "url": "http://localhost:8280/testsuite/general/test" }
]
}
The resource takes this in as a JSON array and loops through the elements using the XPATH expression //tests/type and generates a status message (200 if it can do anything, ERR if not).
Ideally, I'd like to be able to incrementally add the types into some sort of a global array property which would eventually become [DSS, ESB, GREG, GW, MB, ID, BOGUS] so I can write a script to run through this and produce a payload to return something like the below:
{
"results": [
{ "TYPE": "DSS", "STATUS": "200" },
{ "TYPE": "ESB", "STATUS": "200" },
{ "TYPE": "GREG", "STATUS": "200" },
{ "TYPE": "GW", "STATUS": "200" },
{ "TYPE": "MB", "STATUS": "200" },
{ "TYPE": "ID", "STATUS": "200" },
{ "TYPE": "BOGUS", "STATUS": "ERR" }
]
}
I've been searching for a way to do this for a couple of days now, to no avail so if it's simply not possible or if I've just been looking for the wrong thing, I don't know but I'd really like to avoid producing a static resource, enabling future expansion with minimal involvement for me.
You can save your payload in the gov registry with this script :
<script language="js"><![CDATA[
importPackage(Packages.org.apache.synapse.config);
mc.getConfiguration().getRegistry().newResource("gov:/trunk/Test/TestTypes",false);
mc.getConfiguration().getRegistry().updateResource("gov:/trunk/Test/TestTypes",mc.getPayloadXML().toString());
]]></script>
newResource create the resource if it does not exist
you can use
mc.getPayloadJSON() instead of mc.getPayloadXML()
A sample with a resource 'TESTSOF' like this :
<root>
<value><child>1</child></value>
<value><child>2</child></value>
<value><child>3</child></value>
</root>
You can iter all "value" with :
<property name="TESTSOF" expression="get-property('registry','gov:/trunk/TESTSOF')" type="OM"/>
<iterate continueParent="true" sequential="false" preservePayload="false" expression="$ctx:TESTSOF//value">
<target>
<sequence>
<log level="full"/>
</sequence>
</target>
</iterate>
A sample with JSON :
Load JSON as the current message :
<payloadFactory media-type="json">
<format>$1</format>
<args>
<arg evaluator="xml" expression="get-property('registry','gov:/trunk/Test/TestTypes')"/>
</args>
</payloadFactory>
Iterate :
<iterate continueParent="true" sequential="false" preservePayload="false" expression="//tests">
<target>
<sequence>
<log level="full"/>
</sequence>
</target>
</iterate>