When performing a query message in FHIR I have a bundle with a MessageHeader linked to a Query resource
The FHIR spec states
The receiver processes the message, and then returns a message with a message header, a query with response details, and either an error in the query response, or a set of resources that meet the query criteria. See the examples for an example query response message.
So does that mean that the MessageHeader "response" class is never used if the message is a query, as the response is actually within the Query resource itself?
Well, the response MessageHeader points to the Query as the "response", and that contains everything. You could say that's not really necessary, but it just creates consistency across all message responses
Related
I'm trying to find a single graph query to get messages (emails) sent by me to external recipient/s (not from my organization).
The response should include an email that was sent to both internal and external recipients.
Is it possible?
I tried filtering by toRecipients,ccRecipients,bccRecipients but these are not filterable.
Also tried the $search query parameter but couldn't find a way to find emails that contains at least one recipients whose domain is not #mydomain.com.
Thanks!
No, you cannot filter it on a single call since there is no such property that decides whether the recipient is external or internal. You need to filter them on your end(By code) whether it belongs to your organization or not. You can raise a feature request for this in the Microsoft Graph Feedback Forum so that it may be implemented in the future.
I have a HTTP PUT/POST method to update a document in the database. However, in certain conditions (for example, the input transaction timestamp is less than the timestamp on the document), the PUT/POST method does not apply the update. What is the appropriate HTTP status code to return in such cases, to notify the caller that the update did not happen?
Look at the answer here
Ideally, you should return a 400 status code (bad request) with a message indicating why the request failed. This allows anyone using your API to understand why the request was not successful.
I'm building a web-based reporting tool that queries but does not change large amounts of data.
In order to verify the reporting query, I am using a form for input validation.
I know the following about HTTP GET:
It should be used for idempotent requests
Repeated requests may be cached by the browser
What about the following situations?
The data being reported changes every minute and must not be cached?
The query string is very large and greater than the 2000 character URL limit?
I know I can easily just use POST and "break the rules", but are there definitive situations in which POST is recommended for idempotent requests?
Also, I'm submitting the form via AJAX and the framework is Python/Django, but I don't think that should change anything.
I think that using POST for this sort situation is acceptable. Citing the HTTP 1.1 RFC
The action performed by the POST method might not result in a
resource that can be identified by a URI. In this case, either 200
(OK) or 204 (No Content) is the appropriate response status,
depending on whether or not the response includes an entity that
describes the result.
In your case a "search result" resource is created on the server which adheres to the HTTP POST request specification. You can either opt to return the result resource as the response or as a separate URI to the just created resource and may be deleted as the result resource is no longer necessary after one minute's time(i.e as you said data changes every one minute).
The data being reported changes every minute
Every time you make a request, it is going to create a new resource based on your above statement.
Additionally you can return 201 status and a URL to retrieve the search result resource but I m not sure if you want this sort of behavior but I just provided as a side note.
Second part of your first question says results must not be cached. Well this is something you configure on the server to return necessary HTTP headers to force intermediary proxies and clients to not cache the result, for example, with If-Modified-Since, Cache-control etc.
Your second question is already answered as you have to use POST request instead of GET request due to the URL character limit.
I have seen multiple ways in the past of returning success/failure responses from ajax controller actions from backend services.
Is there an accepted best practice for this?
Im thinking in terms of whether the call was successful and also the transport of any error messages.
http codes
true / string (which would contain the error message)
json encoded object containing success/failure flag + data
etc
Ive seen things like the above and also 'success' / 'error' responses etc.
My specific scenario here is a controller say for example testConnectionController. It tests whether a database connection is active or has any issues and reports the status back to the client.
You should definitely follow the recommendations for http response codes. Don't be tempted to ignore setting the response code in favor of some structured json error response. Other than that it is really dependent on the needs of you application. What ever you end up going with it is helpful to be consistent across all of your responses. e.g. If you are going to return an error as json make sure every http end point returns the same structure. That way your client can react in the same way to every error response. Generally speaking there isn't much your client is going to be able to do other than display the error to the user so a simple response like this, with various messages, will cover most cases:
{
"success" : false,
"message" : "Terrible things occurred!"
}
What is the difference between request, response and server?
Request : From Client to Server
Response: From Server to Client
Server: Receive Request and Send Response
Client: Send Request and Receive Response
A client (web user) makes a Request to a Server which processes the Request and determines the appropriate Response
Server: Machine that provide something for client.
Focus at Server,
Request is message that arrive to server for request something.
Response is message that send from server to client for give thing that client what.
anyway REQUEST/RESPONSE means you can know it with common sense.
See also:
http://en.wikipedia.org/wiki/Request-response
The 1st answer (Ramesh Soni's answer) is simple and concise. I also wanna share a useful terms distinction that's relevance to this.
What's the difference between request and query???
First of all, query and request can both be nouns and verbs. E.g:
I requested a refund.
We received a request for a refund.
I queried the price.
We received a query about the price.
To request something is to ask for something, an object or a favour etc. A request is a polite demand. To query is to ask about something i.e. you are wanting information. A query is a question.
Also, QUERY is an inquiry(Query and inquiry are synonyms)
They are both requests but the difference is that the QUERY is a precise request. In informatics, if you need information about something you need to send a specific request with precise information.
"I queried information about user account Maxim Pavlov" = "I need to know about this website users. In particular, I need to know if there is any Maxim Pavlov registered on this site".
If you are Arabic, best translations in Arabic would be, request = طلب and query = إستعلام)