Validate the format of timestamp string passed in XML request body - azure

I am getting timestamp (2021-10-12T00:00:30.0+05:00) as a field in XML request body, which I need to validate whether it adheres to a specific format (yyyy-MM-ddTHH:mm:ss.fzzz) or not and return error if it does not pass the validation.
I tried using APIM expressions, but it does not allow using DateTime.TryParseExact(), a C# method. If anyone has any pointers, please let me know how can we achieve this?

After further reading the documentation , found out that there is no direct way to check if the timestamp matches the given the format. So went ahead with the regex matching to achieve it.
I used the below mentioned regex
^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)(([+-]\d\d:\d\d)|Z)$

Related

Add Parameter Values to Query String of get request in ADF

I have a Copy Data task which is obtaining data from an API
The API is a GET call to a method and requires 2 parameters
_token
Symbols
I have defined these as parameters
What is the syntax that allows me to use the values of my parameters as the values that are in the query string? So in the screenshot above Symbols is hard coded, but I want the value to be the value of the parameters
I need a screen solution rather than code please as I am not comfortable with ADF yet and I dont know how to get to the code/ARM views
Paul
Using a feature called string interpolation where expressions are wrapped in #{ ... }
Click on the Base URL field. Add Parameters. Using Concat expression function,
Example:
#{Concat('https://stackoverflow.com/questions/GetRealTimeRates?',linkedService().Symbols,'=',linkedService()._token)}
Add first parameter:
Add second parameter:
Test connection. If you see any error, it would provide a description as to debug further.

FHIR Sorting - How to find out which parameter to pass

Team, I am using FHIR bluebutton for CMS data (Claims data) and
now I want to apply sorting in FHIR data
we are getting bundle of explanation of Benefit(EOB)
https://www.hl7.org/fhir/search.html#sort
I have tried passing date and status params in that _sort
but still not getting sorted data
and I am very much in confusion what to pass as a parameter
suppose I want to sort by ClaimNumber
what to pass, please help and suggest me
You will have to use a search parameter as input for the sorting. For example sorting on last updated date descending would look like this:
GET [base]/ExplanationOfBenefit?_sort=-_lastUpdated
I'm not familiar with which field of ExplanationOfBenefit would hold the ClaimNumber you mention, but if you mean the EOB identifier, the request could be this:
GET [base]/ExplanationOfBenefit?_sort=identifier
If you use the correct syntax, success will still depend on whether the server has implemented sorting on that parameter.

Difference between operators in a URL

What's the difference between using : and ? in a URL? For example /products/:id and /products?id=1? I am trying to get the values from the URL like this Product.findById (req.params.id) but I was wondering which one is most suitable. I know using : do I have to use req.params and ? req.query but I don't understand the difference between them, are they the same?
in my point of view, it is totally different if you are using RESTFUL API pattern
/products/:id called path parameters
The path parameters determine the resource you’re requesting for. Think of it like an automatic answering machine that asks you to press 1 for service, press 2 for another service, 3 for yet another service and so on.
Path parameters are part of the endpoint itself and are not optional
but query parameters
Technically, query parameters are not part of the REST architecture, and they used to help you completely understand how to read and use API’s Query parameters give you the option to modify your request with key-value pairs.
Having your parameters in the query is conceptually optional to the router, query parameters are more of properties and descriptions of the request itself, like when saying GET /users?sort=asc, in this case, the sort attribute was more of a description to the request and the request could complete the fetch without it, that might not always be the case, but a query parameter still describes its request even if it was mandatory.
On the other hand, URL parameters are part of the request itself, the URL without the parameter doesn't make sense, like GET /users/:userID, in this case, not supplying userID will supply unexpected data (A list of users for example) if it didn't break the router completely. URL parameters play part in defining the request rather than just describing it, and they can't be optional.

Marklogic : "highlight" seem not work withe Node.js and QueryBuilder

I try to get an extract of the text with the searched words highlighted on a JSON collection.
My search syntax is:
qb.word(qb.field('doc_text'),vartxt)
With 'doc_text' declared as field
(field type: root, include root: false, includes: doc_text), in an Node.js application.
The search works well, and it is done well on this field ...
But in txt[0].results[kl].matches[0]['match-text'], I find the first 3 properties of the JSON,
and not an extract from 'doc_text' with the words found.
I have another application in which the highlights work correctly, but it is based on XML.
Did I forget something in the field declaration, or is the operation different between JSON
and XML data, or is the highlight system not running on JSON via Node.js and QueryBuilder ?
Kind regards
Fields do not work quite the same way in XML and JSON. I think you're running into this limitation:
http://docs.marklogic.com/guide/app-dev/json#id_24090
The value of a field in XML can be the concatenation of all the text nodes, but the same does not apply in JSON.
I think I understood !!!
This query gives a correct snippet, with the extract and the words highlighted :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'))
On the other hand, this query gives the first 3 fields of the JSON :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'), mkcq.value(mkcq.element('','doc_user'), 'mbp'))
I do not know if this is normal or not, but it should be able to be corrected either by a simplified query and a selection on the returned records, evening by a particular snippeter.
Kind regards

Search and filter onedrive request

I am trying to search for only folders with specific name, so I am using search and filter parameters. According to this search docs the search query should look like this:
GET /drive/root/search(q='vacation')
But if I want to add filter then according to this filter docs I should add filter=folder ne null but problem is how do I add It to original string ? In filter docs there is example of request
GET /drive/root/search?q=vacation&filter=image%20ne%20null%20and%20file%20ne%20null
which uses different syntax then example from search docs, and If I try to change It to my use like this
GET /drive/root/search?q=folderName&filter=folder ne null then I get 400 bad request reponse. So how can I search for specific item that is only folder ? thanks.
I wish I could comment, all you need to do is UrlEncode your parameters, quoting from the search doc.
Note: Samples omit proper URL encoding for readability. Actual filter syntax usage must be URL encoded.
For filter=folder ne null
This is what you should do append to url
filter%3Dfolder+ne+null

Resources