When I tried to get the sessions based on start and end time, I can get only the named sessions(like Morning walking in the image) but not other sessions. Can any one tell me why this kind of data's not fetched.
API:
https://www.googleapis.com/fitness/v1/users/me/sessions?startTime=2016-03-08T00:00:00.000Z&endTime=2016-03-08T22:00:00.000Z&access_token=*******
Not only this date but also for all the date, I have gets only the named sessions.
Response:
{
"session": [
{
"id": "b514327692edd309:activemode:walking:1457414580406",
"name": "Morning walking",
"startTimeMillis": "1457414580406",
"endTimeMillis": "1457414781711",
"modifiedTimeMillis": "1457415751927",
"application": {
"packageName": "com.google.android.apps.fitness"
},
"activityType": 7
}
]
}
Related
It is very common that the stock entries of a product are updated in the shop by a different ERP system than the system that updates the product information (number, properties, etc.). Shopware 6 does not seem to support this method and throws the error seen below.
I do understand that for the initial creation of a product there are some required fields like productNumber or stock but when updating an already existing product, it should be totally fine to leave those values out, so that they can be updated by an external system.
This worked in Shopware 5 but not in Shopware 6. Does anyone know a workaround?
(I am thinking about sending the existing value from Shopware because then it is technically not updated but that is my last resort.)
Array
(
[code] => c1051bb4-d103-4f74-8988-acbcafc7fdc3
[status] => 400
[detail] => This value should not be blank.
[template] => This value should not be blank.
[meta] => Array
(
[parameters] => Array
(
[{{ value }}] => null
)
)
[source] => Array
(
[pointer] => /0/stock
)
)
Full example for a request payload
{
"newData": {
"action": "upsert",
"entity": "product",
"payload": [
{
"id": "206c59a3339383101655aae7598e328c",
"language": "default",
"taxId": "6460303d84264f36858d1fe9e8c2f60f",
"name": "SLT 95 Nano Crystal",
"active": true,
"visibilities": [
{
"id": "d43840cff1b2bcc741a9a83ebb5b3c16",
"salesChannelId": "e8d8fd2337dd42e0a86b47ea68739824",
"visibility": 30
}
],
"categories": [
{
"id": "66ca2d80dc532d4d6659b4430e6954a8"
}
],
"description": "A not so much very short text. Another short text.",
"price": [
{
"net": 9999.99,
"gross": 9999.99,
"linked": true,
"currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca"
}
],
"productNumber": "P_10254",
"crossSellings": [
{
"id": "b3e3171397d30794171877fed2329d96",
"name": "Similar Products",
"assignedProducts": [],
"type": "productList",
"active": true,
"sortBy": "name",
"sortDirection": "ASC",
"limit": 24,
"position": 1
}
]
}
]
}
}
Short example for a request payload
"payload": [
{
"id": "206c59a3339383101655aae7598e328c",
"language": "default",
"taxId": "6460303d84264f36858d1fe9e8c2f60f",
"name": "SLT 95 Nano Crystal",
"active": true,
...
}
]
I simply do not send the stock for a normal product upsert in hopes that Shopware uses the already existing stock.
With the version "v6.4.4.1 Stable Version" Shopware introduced a concept change which allows you to update existing products without having to send all required fields.
This solves this issue and is very useful if for example the stocks shall be maintained by hand and not be controlled by the API calls.
Let's say we're handling the advertising of various job openings across several channels (newspapers, job boards, etc.). For each channel, we can buy a "publication period" which will mean the channel will advertise our job openings during that period. How can we find the jobs for a given channel that have a publication period valid for today (i.e. starting on or before today, and ending on or after today)? The intent is to be able to generate a feed of "active" job openings that (e.g.) a job board can consume periodically to determine which jobs should be displayed to its users.
Another wrinkle is that each job opening is associated with a given tenant id: the feeds will have to be generated scoped to tenant and channel.
Let's say we have the following simplified documents (if you think the data should be modeled differently, please let me know also):
{
"_id": "A",
"tenant_id": "foo",
"name": "Job A",
"publication_periods": [
{
"channel": "linkedin",
"start": "2021-03-10T00:00:0.0Z",
"end": "2021-03-17T00:00:0.0Z"
},
{
"channel": "linkedin",
"start": "2021-04-10T00:00:0.0Z",
"end": "2021-04-17T00:00:0.0Z"
},
{
"channel": "monster.com",
"start": "2021-03-10T00:00:0.0Z",
"end": "2021-03-17T00:00:0.0Z"
}
]
}
{
"_id": "B",
"tenant_id": "foo",
"name": "Job B",
"publication_periods": [
{
"channel": "linkedin",
"start": "2021-04-10T00:00:0.0Z",
"end": "2021-04-17T00:00:0.0Z"
},
{
"channel": "monster.com",
"start": "2021-03-15T00:00:0.0Z",
"end": "2021-03-20T00:00:0.0Z"
}
]
}
{
"_id": "C",
"tenant_id": "foo",
"name": "Job C",
"publication_periods": [
{
"channel": "monster.com",
"start": "2021-05-15T00:00:0.0Z",
"end": "2021-05-20T00:00:0.0Z"
}
]
}
{
"_id": "D",
"tenant_id": "bar",
"name": "Job D",
"publication_periods": [
...
]
}
How can I query the jobs linked to tenant "foo" that have an active publication period for "monster.com" on for the date of 17.03.2021? (I.e. this query should return both jobs A and B.)
Note that the DB will contain documents of other (irrelevant) types.
Since I essentially need to "find all job openings containing an object in the publication_periods array having: CHAN as the channel value, "start" <= DATE, "end" >= DATE" it appears I'd require a Mango query to achieve this, as standard view queries don't provide comparison operators (if this is mistaken, please correct me).
Naturally, I want the Mango query to be executed only on relevant data (i.e. exclude documents that aren't job openings), but I can find references on how to do this (whether in the docs or elsewhere): all resources I found simply seem to define the Mango index on the entire set of documents, relying on the fact that documents where the indexed field is absent won't be indexed.
How can I achieve what I'm after?
Initially, I was thinking of creating a view that would emit the publication period information along with a {'_id': id} object in order to "JOIN" the job opening document to the matching periods at query time (per Best way to do one-to-many "JOIN" in CouchDB). However, I realized that I wouldn't be able to query this view as needed (i.e. "start" value before today, "end" value after today) since I wouldn't have a definite start/end key to use... And I have no idea how to properly leverage a Mango index/query for this. Presumably I'd have to create a partial index based on document type and the presence of publication periods, but how can I even index the multiple publication periods that can be located within a single document? Can a Mango index be defined against a specific view as opposed to all documents in the DB?
I stumbled upon this answer Mango search in Arrays indicating that I should be able to index the data with
{
"index": {
"fields": [
"tenant_id",
"publication_periods.[].channel",
"publication_periods.[].start",
"publication_periods.[].end"
]
},
"ddoc": "job-openings-periods-index",
"type": "json"
}
And then query them with
{
"selector": {
"tenant_id": "foo",
"publication_periods": {
"$elemMatch": {
"$and": [
{
"channel": "monster.com"
},
{
"start": {
"$lte": "2021-03-17T00:00:0.0Z"
}
},
{
"end": {
"$gte": "2021-03-17T00:00:0.0Z"
}
}
]
}
}
},
"use_index": "job-openings-periods-index"
"execution_stats": true
}
Sadly, I'm informed that the index "was not used because it does not contain a valid index for this query" and terrible performance, which I will leave for another question.
I want to edit the color of an individual event as I insert it into a Google Calendar using Python to interact with the Google API. I'm using the dictionary below to compose the event itself, and I thought that colorId was a part of the event, but I feel like I'm fundamentally misunderstanding how to use to use it.
event = {
"summary": name,
"colorId": "Tangerine",
"start": {
"date": ymd,
},
"end": {
"date": ymd,
},
"recurrence": [
"RRULE:FREQ=YEARLY;COUNT=100",
],
}
event = service.events().insert(calendarId="id number of calendar goes here", body=event).execute()
However, I don't really know how to go about fixing this. Any help is appreciated.
Ahh, cripes. Answer is straightforward. The dictionary is properly formatted as it stands, but the input under "colorId" should be a numeric string (e.g., "6", etc.). Reference can be found here: https://jsfiddle.net/ztjga41q/
event = {
"summary": name,
"colorId": "6",
"start": {
"date": ymd,
},
"end": {
"date": ymd,
},
"recurrence": [
"RRULE:FREQ=YEARLY;COUNT=100",
],
}
I'm getting an error: cannot include both a phrase slot and another intent slot. Error code: InvalidIntentSamplePhraseSlot while building Alexa skill.
Sample JSON is as follows,
{
"name": "HackathonListIntent",
"slots": [
{
"name": "resultCount",
"type": "AMAZON.NUMBER"
},
{
"name": "search1",
"type": "AMAZON.SearchQuery"
},
{
"name": "search2",
"type": "AMAZON.SearchQuery"
}
],
"samples": [
"{resultCount} for {search1} from {search2}",
]}
resultCount: skill fetch thousands of result from backend this parameter will restrict result length as per users convenience.
search1 and search2 are different independent search parameter which user may ask.
FYI: I have tried this
For the InvalidIntentSamplePhraseSlot issue, according to Amazon's documentation, you can only use one AMAZON.SearchQuery slot per intent.
"Make sure that your skill uses no more than one AMAZON.SearchQuery slot per intent."
https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#amazonsearchquery
Also, for your sample entry make sure the array with one item does not include a comma. It will cause an Invalid JSON error.
"samples": [
"{resultCount} for {search1} from {search2}"
]}
AMAZON.SearchQuery are limited to 1 slot per intent and also it will need a phrase along with the slot. I would suggest you to use AMAZON.Person as it can take any value and dose not need a phrase.
{
"name": "HackathonListIntent",
"slots": [
{
"name": "resultCount",
"type": "AMAZON.NUMBER"
},
{
"name": "search2",
"type": "AMAZON.Person"
},
{
"name": "search2",
"type": "AMAZON.Person"
}
],
"samples": [
"{resultCount} for {search1} from {search2}"
]
}
Hi how can I get the activity from google fit data. I have almost done all aspects after getting the access token how can I get the google fit datas, by using the below code I can get only this kind of response
code:
gFit.listExistingSessions(req.query.token,function(status,data){
// console.log('Sessions',data);
res.render('results', { resp: data });
});
response:
"session": [
{
"id": "3116a82009dd6cd7:activemode:running:1456064572752",
"startTimeMillis": "1456064572752",
"endTimeMillis": "1456114372880",
"modifiedTimeMillis": "1456745578987",
"application": {
"packageName": "com.google.android.apps.fitness"
},
"activityType": 8
},
{
"id": "3116a82009dd6cd7:activemode:running:1456064572752",
"name": "Evening running",
"startTimeMillis": "1456064572752",
"endTimeMillis": "1456114370411",
"modifiedTimeMillis": "1456745578992",
"application": {
"packageName": "com.google.android.apps.fitness"
},
"activityType": 8
},
{
"id": "3116a82009dd6cd7:activemode:biking:1456742139081",
"startTimeMillis": "1456742139081",
"endTimeMillis": "1456742187907",
"modifiedTimeMillis": "1456745578998",
"application": {
"packageName": "com.google.android.apps.fitness"
},
"activityType": 1
}
]
Can any one tell me how to get the calories burned, steps count, miles and minutes of each of the sessions.
According to their documentation, sessions are only a mean of organizing workouts, but they do not provide specific workout data. For that, you have to query datasets that overlap with the time interval of the session.
For more information on how to query specific datasets, see Working with datasets.
This is the example request for querying datasets:
https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.step_count.delta:1234567890:Example%20Manufacturer:ExampleTablet:1000001/datasets/1397513334728708316-1397515179728708316
There, you have to replace com.google.step_count.delta with whatever data type you require, and also replace the timestamps at the end of the query with the ones that match your session start and end times.