Enable root URL for Asymmetrik FHIR server to save Bundle transactions? - javascript

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/"
}
}
]
}

Related

Whatsapp message api not support interactive single product message

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"
}
}

Why GraphQL is not detecting a new field in a JSON object

I'm new in Gatsby Development, in my website I'm using a community theme and modifying it in some things.
My problem started when I modified a JSON file called 'settings.json', where I added a field in the siteConfiguration object, the original file was this:
{"siteConfiguration": {
"logo": { "text": "chrisley"},
"navigation": {
"header": [
{ "label": "About", "url": "/#about" },
{ "label": "Blog", "url": "/blog" },
{ "label": "Features", "url": "/#features" },
{ "label": "Github", "url": "/#github" }
],
"ctaButton": {
"openNewTab": true,
"label": "Resume",
"url": "/resume.pdf"
},
"footer": [
{ "label": "Privacy", "url": "/privacy" },
{ "label": "Imprint", "url": "/imprint" }
]
},
"featureToggles": {
"useDarkModeAsDefault": false,
"useDarkModeBasedOnUsersPreference": true,
"useCookieBar": false
}
}
}
And the one where I added the field 'img' inside "logo" is the following:
{"siteConfiguration": {
"logo": { "text": "chrisley","img":"/content/images/logo-dark.png"},
"navigation": {
"header": [
{ "label": "About", "url": "/#about" },
{ "label": "Blog", "url": "/blog" },
{ "label": "Features", "url": "/#features" },
{ "label": "Github", "url": "/#github" }
],
"ctaButton": {
"openNewTab": true,
"label": "Resume",
"url": "/resume.pdf"
},
"footer": [
{ "label": "Privacy", "url": "/privacy" },
{ "label": "Imprint", "url": "/imprint" }
]
},
"featureToggles": {
"useDarkModeAsDefault": false,
"useDarkModeBasedOnUsersPreference": true,
"useCookieBar": false
}
}
}
And when I trying to get the img field in GraphQL with this Query:
query SiteConfiguration {
allSettingsJson: allContentJson {
settings: nodes {
siteConfiguration {
logo {
text
img
}
}
}
}
}
I get the next error:
{
"errors": [
{
"message": "Cannot query field \"img\" on type \"Logo\".",
"locations": [
{
"line": 7,
"column": 11
}
],
"extensions": {
"stack": [
"GraphQLError: Cannot query field \"img\" on type \"Logo\".",
" at Object.Field (/Users/chrisley/Documents/Development/Gatsby/chrisley_dev_website/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js:48:31)",
" at Object.enter (/Users/chrisley/Documents/Development/Gatsby/chrisley_dev_website/node_modules/graphql/language/visitor.js:323:29)",
" at Object.enter (/Users/chrisley/Documents/Development/Gatsby/chrisley_dev_website/node_modules/graphql/utilities/TypeInfo.js:370:25)",
" at visit (/Users/chrisley/Documents/Development/Gatsby/chrisley_dev_website/node_modules/graphql/language/visitor.js:243:26)",
" at validate (/Users/chrisley/Documents/Development/Gatsby/chrisley_dev_website/node_modules/graphql/validation/validate.js:69:24)",
" at graphqlMiddleware (/Users/chrisley/Documents/Development/Gatsby/chrisley_dev_website/node_modules/express-graphql/index.js:98:38)",
" at processTicksAndRejections (node:internal/process/task_queues:95:5)"
]
}
}
]
}
Hope you can help me guys, as always haha 😅
I'll be answering myself because I found the problem hahaha.
The problem was that I was missing updating the Schema of the theme, in particular of this theme was the file gastby/node/createSchemaCustomization.js
So.. after updating the file with this lines:
module.exports = ({ actions }) => {
actions.createTypes(`
...
type Logo {
text: String
img: String
}
...
`);
};
GraphQL detected my new field 'img' of the 'logo' object.
After some research I'm assuming you are using the following starter: https://github.com/konstantinmuenster/gatsby-theme-portfolio-minimal/tree/main/gatsby-theme-portfolio-minimal
Have you tried stopping your development process and cleaning Gatsby cache by:
gatsby clean
Or manually deleting the .cache folder.

Strapi How to link relations between collections REST API

Strapi v4, postgres.
I have two collections Sprites and Tags and I want to link those collections throught REST API when I creating a new Sprite entry. I have a simple API endpoint which is firing strapi.controller('api::sprite.sprite').create(), but I cant understand how can I specify relation to Tags.
I tried many various variants but nothing not worked for me.
For example:
{
"data": {
"tags": [1, 2],
}
}
As I understand right I need to specify Tag's ID, as said at documentation but its not worked for me.
If I create a new entry from Content Manager and specify relation manually its works good.
Also I tried to open all permissions to Tag collection
Sprites:
{
"kind": "collectionType",
"collectionName": "sprites",
"info": {
"singularName": "sprite",
"pluralName": "sprites",
"displayName": "Sprite",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
...
"tags": {
"type": "relation",
"relation": "manyToMany",
"target": "api::tag.tag",
"inversedBy": "sprites"
}
}
}
And Tags:
{
"kind": "collectionType",
"collectionName": "tags",
"info": {
"singularName": "tag",
"pluralName": "tags",
"displayName": "tag"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"name": {
"type": "string"
},
"sprites": {
"type": "relation",
"relation": "manyToMany",
"target": "api::sprite.sprite",
"inversedBy": "tags"
}
}
}

Swagger 'GET' request always returns as text/html Accept type on response and NOT application/json

I have a swagger tag document using the Swagger UI that always returns text/html but it should return application/json. The POST requests and every other type returns application/json but this particular GET request does not. The service end point code is correct. And if I change the request to POST it does return as application/json. So it is just type GET within swagger which does not return the correct type. Any thoughts how to correct the call within the UI to use the application/json?
This is swagger version 2.1.4 that was downloaded recently from the swagger site.
"/bankName": {
"get": {
"summary": "Bank Name Search",
"description": "Bank Name Search, input routing number to return bank name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "query",
"name": "routingNumber",
"description": "Input Bank Routing Number",
"required": true,
"type": "string",
}
],
"responses": {
"200": {
"description": "An array",
"schema": {
"type": "object",
"properties": {
"errorInfo": {
"$ref": "#/definitions/ErrorInfo"
},
"bankName": {
"type": "string",
}
}
}
},
"400": {
"description": "Invalid Request Input supplied"
},
"500": {
"description": "General Unexpected Error"
}
}
}
}
Accept:application/json
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Host:localhost:9086
Origin:http://localhost:9086
Pragma:no-cache
Referer:http://localhost:9086/swagger/index.html
Here is the Java code Spring Restful definition:
#RequestMapping(value="bankName",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
Have you tried this?
"/bankName": {
"get": {
"summary": "Bank Name Search",
"description": "Bank Name Search, input routing number to return bank name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "query",
"name": "routingNumber",
"description": "Input Bank Routing Number",
"required": true,
"type": "string",
}
],
"responses": {
"200": {
"description": "An array",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errorInfo": {
"$ref": "#/definitions/ErrorInfo"
},
"bankName": {
"type": "string",
}
}
}
}
}
},
"400": {
"description": "Invalid Request Input supplied"
},
"500": {
"description": "General Unexpected Error"
}
}
}
}

How to create a global variable in WSO2 ESB - must be updatable

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>

Categories