My medication request resource contains a reference to Organization resource:
"requester": {
"agent": {
"reference": "Practitioner/12345",
"display": "Abhishek Nayyar"
},
"onBehalfOf": {
"reference": "Organization/56789",
"display": "XYZ Hospital"
}
},
I want to fetch this Organization Resource along with medication request resource using a single api call. I am doing this:
GET https://FhirServerBasePath/MedicationRequest?subject:Patient.identifier=1358&_include=MedicationRequest:requester:Organization
However, in the response, I am not getting organization resource. When I try to use the same query for Practitioner (which is also referenced under requester), I am able to fetch it successfully.
In STU3, the MedicationRequest requester search parameter only looks at MedicationRequest.requester.agent. There is no 'standard' search parameter that looks at MedicationRequest.requester.onBehalfOf, which means that unless the server supports a custom search parameter based on that element, there's no way to do an _include for it.
Related
I am currently consuming data from the G Suite API.
An inconvenience I have found is that for some of the APIs the number of resources available might be quite large.
For instance, when I consume the Users:list API (https://www.googleapis.com/admin/directory/v1/users), given the number of resources and the maximum number of results per query I need to perform a significant number of queries. Find below an example JSON response:
{
"kind": "admin#directory#users",
"etag": "\"WqpSTs-zelqnIvn63V............................/v3ENarMfXkTh9ijs3OVkQRoUSVU\"",
"users": [
{
"kind": "admin#directory#user",
"id": "7720745322191632224007",
"etag": "\"WqpSTs-zelqnIvn63V........................PfcSmik3zEJwHAl1UbgSk\"",
"primaryEmail": ...,
...
},
{
"kind": "admin#directory#user",
"id": "227945583287518253104",
"etag": "\"WqpSTs-zelqnIvn63V..........-zY30eInIGOmLI\"",
"primaryEmail": ...,
...
},
...
N-users
...
]
}
I am running this query several times a day.
Ideally I would only retrieve the resources that have changed and the new ones, excluding from the response the ones that have not changed.
Is it possible to do that? If so, how?
Thank you in advance for your answers.
You could create custom attributes for your users, and then filter your requests using the query parameter according to your custom attribute.
Or define exactly what you mean by "changed" or "not changed" as the user properties will change on every login to update the last login attribute.
Update:
You can watch for changes on the list of users in your domain by supplying an address to receive notifications in a POST request to the watch endpoint:
https://www.googleapis.com/admin/directory/v1/users/watch
References:
Users.watch
Custom User Fields
Query string for User fields
I want to update parent relationships for specified entity. The problem is when I query N:1 refs I get referencing attributes that is not always a single-valued navigation property. I do not know how can I distinguish is the attribute parentcustomerid referencing to an account or to a contact entity. So the question is: How can I properly get single-valued navigation property for my specified entity to be able update it using request to PATCH api/data/v9.0/contacts({id}) with the body:
{"single-valued navigation property#odata.bind" :
"/{accounts or contacts}({id})"}
When creating a HTTP Request, add Prefer: odata.include-annotations="*" to your HTTP Request Headers. This way the response not only will have a _[Field Name]_value field with the Id but also a _[Field Name]_value#Microsoft.Dynamics.CRM.lookuplogicalname with the logical name that you look for.
This is an example of a response for a request querying parentcustomerid of a specific contact without the header:
{
"#odata.context": "https://[Organization URI]/api/data/v9.0/$metadata#contacts(_parentcustomerid_value)",
"value": [
{
"_parentcustomerid_value": "bdeb86af-7e1c-e811-a837-000d3ac085f9",
"contactid": "b050f3bb-dbf7-e811-a98a-000d3ac02bae"
}
]
}
And this is an example of a response for the same request with the header added:
{
"#odata.context": "https://[Organization URI]/api/data/v9.0/$metadata#contacts(_parentcustomerid_value)",
"value": [
{
"_parentcustomerid_value#Microsoft.Dynamics.CRM.associatednavigationproperty": "parentcustomerid_account",
"_parentcustomerid_value#Microsoft.Dynamics.CRM.lookuplogicalname": "account",
"_parentcustomerid_value": "bdeb86af-7e1c-e811-a837-000d3ac085f9",
"contactid": "b050f3bb-dbf7-e811-a98a-000d3ac02bae"
}
]
}
I want to display all customers review on my web page. For that, I refer Get a review in the documentation.
But I am confused about account_name in the following request
https://mybusiness.googleapis.com/v4/accounts/account_name/locations/location_name/reviews
What value should i use for account_name?
Account_name = the name of the account you want to get data for
Location_name = the name of the location that you want to get reviews for
Use accounts list to find a list of accounts the current user has access to. Use locations list with account to find a list of the locations for that account
As you can see by the documentation accounts list returns a list of account objects.
Accounts.list
{
"accounts": [
{
object(Account)
}
],
"nextPageToken": string
}
An account resource contains a list of account_name's for the user who is currently authenticated.
{
"name": string,
"accountName": string,
"type": enum(AccountType),
"role": enum(AccountRole),
"state": {
object(AccountState)
},
"profilePhotoUrl": string,
"accountNumber": string,
"permissionLevel": enum(PermissionLevel),
"organizationInfo": {
object(OrganizationInfo)
}
}
Access
Remember you must fill out the form and request access to this api here
Authorization
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
Means that your request must be authenticated before you can use this method. YOu cant access private user data without the permission of the user who owns the data. Oauth I recommend you find the client library for your chosen language and look for information on how to authenticate using oauth2
This sounds like a rookie question, but I'm wondering what's the best way to present paged resources with HAL format? Right now I'm using Spring HATEOAS API to convert Page object into resource PagedResourcesAssembler#toResource(Page<T>, ResourceAssembler<T,R>). This results in the following output:
{
"_links": {
"self": {
"href": "http://example.org/api/user?page=3"
},
…
}
"count": 3,
"total": 498,
"_embedded": {
"users": [
{
"_links": {
"self": {
"href": "http://example.org/api/user/mwop"
}
},
"id": "mwop",
"name": "Matthew Weier O'Phinney"
}
]
}
}
Everything works fine but the only problem is the collection being returned is under _embedded field and has the class name, so the client has to know this class name as well right? Would it be better to just return the collection under content like non-HAL format? If yes how should I achieve it using Spring HATEOAS?
That's not a problem, that's the way _embedded is defined in the HAL specification.
users is not a class, it's a link relation that will allow clients to actually find the collection it was asking for in the first place (e.g. using a JSONPath expression). That's not something coming out of the blue at all but usually is the same link relation, the client used to find that resource in the first place.
Assume an API root exposing this document:
{
"_links": {
"users": {
"href": "…"
},
…
}
}
Seeing that, the client would have to know the semantics of users to find the link it wants to follow. In your case users is basically pointing to a collection resource that supports pagination.
So if the client follows the link named users, it can then find the actual content it's looking for under _embedded.users in the HAL response by combining knowledge about the media type (HAL, _embedded) and the service's application-level semantics (users).
I am trying to do application specific places search with google place api. Here is how I am adding a place:
Request:
{
"location": {
"lat": 37.760538,
"lng": -121.900879
},
"accuracy": 50,
"name": "p2p",
"types": ["other"]
}
I get success response as shown below:
Response:
{
"id" : "dfe583b1ac058750cf524f958afc5e82ade455d7",
"place_id" : "qgYvCi0wMDAwMDBhNWE4OWU4NTMzOjgwOGZlZTBhNjI3OjBjNTU1OTU4M2Q2NDI5YmM",
"reference" : "CkQxAAAAsPE72V-jhHUjj6vPy2HdC__2MhAdXanL6mlFBA4bcayRabKyMlfKFiah7U2vkoCj1P_0w9ESFSv5mfDkyufaZhIQTHBHY_jPGRHEE3EmEAGElhoUXTSylMslwHSTK5tYdstW2rOZKbw",
"scope" : "APP",
"status" : "OK"
}
When I search for this place using radar search, I get ZERO_RESULTS.
Request:
https://maps.googleapis.com/maps/api/place/radarsearch/json?key=key&radius=5000&location=37.761926,-121.891856&keyword=p2p
Response:
{
"html_attributions": [ ],
"results": [ ],
"status": "ZERO_RESULTS"
}
Is there something that I am doing the right way? Please help.
Thanks & Regards,
--Rajani
Your scope is "APP". That means you can access it (via PlaceID) from the application that created the entry only. If the location passes Google's moderation process, then it will gain scope "GOOGLE" and be accessible from the general searches.
scope — Indicates the scope of the place_id. The possible values are:
APP: The place ID is recognised by your application only. This is because your
application added the place, and the place has not yet
passed the moderation process.
GOOGLE: The place ID is available to other applications and on Google Maps.
Note: The scope field is included only in Nearby Search results and
Place Details results. You can only retrieve app-scoped places via the
Nearby Search and the Place Details requests. If the scope field is
not present in a response, it is safe to assume the scope is GOOGLE.
See: https://developers.google.com/places/documentation/search