Account Query. Where does the query go? GET /v3/company/<clientID>/query?query=<selectStatement>&minorversion=59 Does it go in the <selectStatement>? - quickbooks

I am using QuickBooks Online API.
Documentation for the Account Object is here: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account
Sample Request URL:
GET /v3/company/<clientID>/query?query=<selectStatement>&minorversion=59
Content type:text/plain
Production Base URL:https://quickbooks.api.intuit.com
Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com
Sample Query:
select * from Account where Metadata.CreateTime > '2014-12-31'
Sample Return:
{
"QueryResponse": {
"startPosition": 1,
"Account": [
{
"FullyQualifiedName": "Canadian Accounts Receivable",
"domain": "QBO",
"Name": "Canadian Accounts Receivable",
"Classification": "Asset",
"AccountSubType": "AccountsReceivable",
"CurrencyRef": {
"name": "United States Dollar",
"value": "USD"
},
"CurrentBalanceWithSubAccounts": 0,
"sparse": false,
"MetaData": {
"CreateTime": "2015-06-23T09:38:18-07:00",
"LastUpdatedTime": "2015-06-23T09:38:18-07:00"
},
"AccountType": "Accounts Receivable",
"CurrentBalance": 0,
"Active": true,
"SyncToken": "0",
"Id": "92",
"SubAccount": false
},
{
"FullyQualifiedName": "MyClients",
"domain": "QBO",
"Name": "MyClients",
"Classification": "Asset",
"AccountSubType": "AccountsReceivable",
"CurrencyRef": {
"name": "United States Dollar",
"value": "USD"
},
"CurrentBalanceWithSubAccounts": 0,
"sparse": false,
"MetaData": {
"CreateTime": "2015-07-13T12:34:47-07:00",
"LastUpdatedTime": "2015-07-13T12:34:47-07:00"
},
"AccountType": "Accounts Receivable",
"CurrentBalance": 0,
"Active": true,
"SyncToken": "0",
"Id": "93",
"SubAccount": false
},
{
"FullyQualifiedName": "MyJobs",
"domain": "QBO",
"Name": "MyJobs",
"Classification": "Asset",
"AccountSubType": "AccountsReceivable",
"CurrencyRef": {
"name": "United States Dollar",
"value": "USD"
},
"CurrentBalanceWithSubAccounts": 0,
"sparse": false,
"MetaData": {
"CreateTime": "2015-01-13T10:29:27-08:00",
"LastUpdatedTime": "2015-01-13T10:29:27-08:00"
},
"AccountType": "Accounts Receivable",
"CurrentBalance": 0,
"Active": true,
"SyncToken": "0",
"Id": "91",
"SubAccount": false
}
],
"maxResults": 3
},
"time": "2015-07-13T12:35:57.651-07:00"
}
In the Sample Request URL, I need to determine what to type into the "selectStatement".
I have found additional documentation here:
https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries

You have an example of what to put for selectStatement in your post:
select * from Account where Metadata.CreateTime > '2014-12-31'
e.g.:
/v3/company/<clientID>/query?query=select * from Account where Metadata.CreateTime > '2014-12-31'&minorversion=59

Related

Can't update the names of event attendees using the Microsoft Graph API

The following has been tried using the Microsoft Graph API Graph Explorer to eliminate any third-party causes. There is an existing event in an Outlook calendar:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('WWWW')/calendars('XXXX')/events/$entity",
"#odata.etag": "W/\"wIqdPsepnEOtI+GbtqRT1gAAElvUsQ==\"",
"id": "YYYY",
"createdDateTime": "2020-06-18T05:19:22.5766648Z",
"lastModifiedDateTime": "2020-06-18T17:17:23.3143899Z",
"changeKey": "wIqdPsepnEOtI+GbtqRT1gAAElvUsQ==",
"categories": [],
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"iCalUId": "ZZZZ",
"reminderMinutesBeforeStart": 15,
"isReminderOn": false,
"hasAttachments": false,
"subject": "Review proposal",
"bodyPreview": "",
"importance": "normal",
"sensitivity": "normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=YYY&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": null,
"isOnlineMeeting": false,
"onlineMeetingProvider": "unknown",
"allowNewTimeProposals": true,
"recurrence": null,
"onlineMeeting": null,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "text",
"content": ""
},
"start": {
"dateTime": "2020-06-26T14:30:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2020-06-26T15:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"locations": [],
"attendees": [
{
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "attendee#example.com",
"address": "attendee#example.com"
}
},
{
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "Bob Smith",
"address": "organizer#example.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "Bob Smith",
"address": "organizer#example.com"
}
}
}
The attendee's name was not known at the time the event was created. attendee#example.com was given which produced an attendee whose name and email address were both attendee#example.com. Later, the attendee's name became known. A patch request is sent to the organizer's calendar through Microsoft Graph API to update the event with the goal of overwriting the attendee's name, but leaving the email address as is.
{
"#odata.type": "#microsoft.graph.event",
"attendees": [{
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"type": "required",
"emailAddress": {
"address": "attendee#example.com",
"name": "Julie Williams"
}
}, {
"status": {
"response": "none"
},
"type": "required",
"emailAddress": {
"address": "organizer#example.com",
"name": "Bob Smith"
}
}],
"createdDateTime": "2020-06-18T05:19:22.5766648Z",
"end": {
"dateTime": "2020-06-26T15:00:00",
"timeZone": "UTC"
},
"iCalUId": "ZZZZ",
"id": "YYYY",
"importance": "normal",
"isOrganizer": true,
"lastModifiedDateTime": "2020-06-18T05:19:23.7881324Z",
"location": {},
"organizer": {
"emailAddress": {
"address": "organizer#example.com",
"name": "Bob Smith"
}
},
"originalEndTimeZone": "Eastern Standard Time",
"originalStartTimeZone": "Eastern Standard Time",
"reminderMinutesBeforeStart": 15,
"responseRequested": true,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"sensitivity": "normal",
"showAs": "busy",
"start": {
"dateTime": "2020-06-26T14:30:00",
"timeZone": "UTC"
},
"subject": "Review proposal",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=YYYY&exvsurl=1&path=/calendar/item"
}
The response shows that the attendee's name did not change.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('WWWW')/calendars('XXXX')/events/$entity",
"#odata.etag": "W/\"wIqdPsepnEOtI+GbtqRT1gAAElvUsQ==\"",
"id": "YYYY",
"createdDateTime": "2020-06-18T05:19:22.5766648Z",
"lastModifiedDateTime": "2020-06-18T17:17:23.3143899Z",
"changeKey": "wIqdPsepnEOtI+GbtqRT1gAAElvUsQ==",
"categories": [],
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"iCalUId": "ZZZZ",
"reminderMinutesBeforeStart": 15,
"isReminderOn": false,
"hasAttachments": false,
"subject": "Review proposal",
"bodyPreview": "",
"importance": "normal",
"sensitivity": "normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=YYYY&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": null,
"isOnlineMeeting": false,
"onlineMeetingProvider": "unknown",
"allowNewTimeProposals": true,
"recurrence": null,
"onlineMeeting": null,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "text",
"content": ""
},
"start": {
"dateTime": "2020-06-26T14:30:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2020-06-26T15:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"locations": [],
"attendees": [
{
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "attendee#example.com",
"address": "attendee#example.com"
}
},
{
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
},
"emailAddress": {
"name": "Bob Smith",
"address": "organizer#example.com"
}
}
],
"organizer": {
"emailAddress": {
"name": "Bob Smith",
"address": "organizer#example.com"
}
}
}
Should I expect the attendee's name to be updated? Is there another way to do it?

Pull Request Lists and the set of approvers from BITBUCKET SERVER API

Is it possible to get the List of all pull request with the details like the date when it was raised, the Person who raised it and the list of all the approvers from the BITBUCKET SERVER using the REST APIs
Absolutely, You can fetch the list of Pull requests along with all the other details like who raised it, when it was raised and who are the reviewers using the following API,
https://docs.atlassian.com/bitbucket-server/rest/7.4.0/bitbucket-rest.html#idp285
You will have the following as response,
{
"size": 1,
"limit": 25,
"isLastPage": true,
"values": [
{
"id": 101,
"version": 1,
"title": "Talking Nerdy",
"description": "It’s a kludge, but put the tuple from the database in the cache.",
"state": "OPEN",
"open": true,
"closed": false,
"createdDate": 1359075920,
"updatedDate": 1359085920,
"fromRef": {
"id": "refs/heads/feature-ABC-123",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"toRef": {
"id": "refs/heads/master",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"locked": false,
"author": {
"user": {
"name": "tom",
"emailAddress": "tom#example.com",
"id": 115026,
"displayName": "Tom",
"active": true,
"slug": "tom",
"type": "NORMAL"
},
"role": "AUTHOR",
"approved": true,
"status": "APPROVED"
},
"reviewers": [
{
"user": {
"name": "jcitizen",
"emailAddress": "jane#example.com",
"id": 101,
"displayName": "Jane Citizen",
"active": true,
"slug": "jcitizen",
"type": "NORMAL"
},
"lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998",
"role": "REVIEWER",
"approved": true,
"status": "APPROVED"
}
],
"participants": [
{
"user": {
"name": "dick",
"emailAddress": "dick#example.com",
"id": 3083181,
"displayName": "Dick",
"active": true,
"slug": "dick",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": false,
"status": "UNAPPROVED"
},
{
"user": {
"name": "harry",
"emailAddress": "harry#example.com",
"id": 99049120,
"displayName": "Harry",
"active": true,
"slug": "harry",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": true,
"status": "APPROVED"
}
],
"links": {
"self": [
{
"href": "http://link/to/pullrequest"
}
]
}
}
],
"start": 0 }

How to add dashboard configuration json file in Grafana image?

I have a grafana docker image which have hawkular-datasource pre-configured using configuration files.
After after running grafana instance, I have a json given by teammate, which can be imported inside grafana and that json file creates dashboard when imported.
How do I make that dashboards appear by default in Grafana instance?
I tried copying the json file to /etc/grafana/provisioning/dashboards/ folder and created a new docker image. But when I run the image, the instance doesn't contain the dashboard at the homepage or anywhere in it.
How do I add this json file in docker image. Am I following the correct way?
I tried this http://docs.grafana.org/administration/provisioning/ But it didn't help out much. Any suggestion?
Here is the json file.
{
"id": null,
"title": "Openshift Metrics",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
"rows": [
{
"collapse": false,
"editable": true,
"height": "322px",
"panels": [
{
"content": "<center><p style='font-size: 40pt'>$app</p></center>",
"editable": true,
"error": false,
"id": 23,
"isNew": true,
"links": [],
"mode": "html",
"repeatIteration": 1476706310439,
"scopedVars": {},
"span": 2,
"style": {
"font-size": "36pt"
},
"title": "",
"type": "text"
},
{
"aliasColors": {},
"bars": false,
"datasource": "Hawk-DS",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 9,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeatIteration": 1476706310439,
"scopedVars": {},
"seriesOverrides": [],
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"queryBy": "tags",
"rate": false,
"refId": "A",
"seriesAggFn": "none",
"tags": [
{
"name": "container_name",
"value": "$app"
},
{
"name": "descriptor_name",
"value": "memory/usage"
}
],
"target": "select metric",
"tagsQL": "container_name IN [$app] AND descriptor_name='memory/usage'",
"timeAggFn": "avg",
"type": "gauge"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Memory usage",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": 0,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": true,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "Hawk-DS",
"editable": true,
"error": false,
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"height": "100px",
"id": 12,
"interval": null,
"isNew": true,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"repeatIteration": 1476706310439,
"scopedVars": {},
"span": 2,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [
{
"queryBy": "tags",
"rate": false,
"refId": "A",
"seriesAggFn": "sum",
"tags": [
{
"name": "container_name",
"value": "$app"
},
{
"name": "descriptor_name",
"value": "memory/usage"
}
],
"target": "select metric",
"tagsQL": "container_name IN [$app] AND descriptor_name='memory/usage'",
"timeAggFn": "live",
"type": "gauge"
}
],
"thresholds": "140000000,180000000",
"title": "Live, all pods",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": true,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "Hawk-DS",
"editable": true,
"error": false,
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"height": "100px",
"id": 15,
"interval": null,
"isNew": true,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"repeatIteration": 1476706310439,
"scopedVars": {},
"span": 2,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [
{
"queryBy": "tags",
"rate": false,
"refId": "A",
"seriesAggFn": "avg",
"tags": [
{
"name": "container_name",
"value": "$app"
},
{
"name": "descriptor_name",
"value": "memory/usage"
}
],
"target": "select metric",
"tagsQL": "container_name IN [$app] AND descriptor_name='memory/usage'",
"timeAggFn": "live",
"type": "gauge"
}
],
"thresholds": "140000000,180000000",
"title": "Live per pod",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": true,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "Hawk-DS",
"editable": true,
"error": false,
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"height": "100px",
"id": 10,
"interval": null,
"isNew": true,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"repeatIteration": 1476706310439,
"scopedVars": {},
"span": 2,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [
{
"queryBy": "tags",
"rate": false,
"refId": "A",
"seriesAggFn": "sum",
"tags": [
{
"name": "container_name",
"value": "$app"
},
{
"name": "descriptor_name",
"value": "memory/usage"
}
],
"target": "select metric",
"tagsQL": "container_name IN [$app] AND descriptor_name='memory/usage'",
"timeAggFn": "avg",
"type": "gauge"
}
],
"thresholds": "140000000,180000000",
"title": "Average, all pods",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": true,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "Hawk-DS",
"editable": true,
"error": false,
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"height": "100px",
"id": 13,
"interval": null,
"isNew": true,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"repeatIteration": 1476706310439,
"scopedVars": {},
"span": 2,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [
{
"queryBy": "tags",
"rate": false,
"refId": "A",
"seriesAggFn": "avg",
"tags": [
{
"name": "container_name",
"value": "$app"
},
{
"name": "descriptor_name",
"value": "memory/usage"
}
],
"target": "select metric",
"tagsQL": "container_name IN [$app] AND descriptor_name='memory/usage'",
"timeAggFn": "avg",
"type": "gauge"
}
],
"thresholds": "140000000,180000000",
"title": "Average per pod",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": true,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "Hawk-DS",
"editable": true,
"error": false,
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"height": "100px",
"id": 11,
"interval": null,
"isNew": true,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"repeatIteration": 1476706310439,
"scopedVars": {},
"span": 2,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [
{
"queryBy": "tags",
"rate": false,
"refId": "A",
"seriesAggFn": "sum",
"tags": [
{
"name": "container_name",
"value": "$app"
},
{
"name": "descriptor_name",
"value": "memory/usage"
}
],
"target": "select metric",
"tagsQL": "container_name IN [$app] AND descriptor_name='memory/usage'",
"timeAggFn": "max",
"type": "gauge"
}
],
"thresholds": "140000000,180000000",
"title": "Max, all pods",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": true,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "Hawk-DS",
"editable": true,
"error": false,
"format": "bytes",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"height": "100px",
"id": 14,
"interval": null,
"isNew": true,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"repeatIteration": 1476706310439,
"scopedVars": {},
"span": 2,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [
{
"queryBy": "tags",
"rate": false,
"refId": "A",
"seriesAggFn": "avg",
"tags": [
{
"name": "container_name",
"value": "$app"
},
{
"name": "descriptor_name",
"value": "memory/usage"
}
],
"target": "select metric",
"tagsQL": "container_name IN [$app] AND descriptor_name='memory/usage'",
"timeAggFn": "max",
"type": "gauge"
}
],
"thresholds": "140000000,180000000",
"title": "Max per pod",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": "app",
"scopedVars": {
"app": {
"text": "aloha",
"value": "aloha",
"selected": true
}
},
"title": "New row"
}
],
"time": {
"from": "now-30m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"templating": {
"list": [
{
"current": {},
"datasource": "Hawk-DS",
"hide": 0,
"includeAll": true,
"label": "Application",
"multi": true,
"name": "app",
"options": [],
"query": "tags/container_name:*",
"refresh": 1,
"regex": "",
"type": "query"
}
]
},
"annotations": {
"list": []
},
"schemaVersion": 12,
"version": 32,
"links": [],
"gnetId": null
}
You should put a YAML file pointing to the JSON files in that folder. For example write /etc/grafana/provisioning/dashboards/local.yml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards
options:
path: /var/lib/grafana/dashboards
And then write your JSON file to /var/lib/grafana/dashboards/openshift.json.
Before Grafana 5, my previous solution was to wrap the whole Docker process in a script that uses the API to create the dashboard once the Docker container is up. You can use the GF_SECURITY_ADMIN_PASSWORD environment variable to set the password. You can also use GF_AUTH_ANONYMOUS_ENABLED, but you'll need to make sure it's not accessible to the outside world.
docker run -p 3000:3000 -e GF_AUTH_ANONYMOUS_ENABLED=true grafana/grafana ...
sleep 10 # wait for grafana to load (use a better method of waiting in production)
curl -skfS -XPOST --header "Content-Type: application/json" "http://localhost:3000/grafana/api/dashboards/db" --data-binary #dashboard.json
I've faced with the same problem and I hope the next solution could help somebody.
For example, you have the next working directory:
├── docker-compose.yml
├── grafana
│ ├── Dockerfile
│ ├── dashboards
│ │ └── exported_dashboard.json #dashboard you saved before
│ └── provisioning
│ │
│ ├── dashboards
│ │ └── all.yml
│ └── datasources
│ └── all.yml
In the Dockerfile you have to add provisioning and dashboards folders into grafana container:
FROM grafana/grafana:latest
ADD ./provisioning /etc/grafana/provisioning
ADD ./dashboards /var/lib/grafana/dashboards
In provisioning/dashboards/all.yml you have to set path to imported dashboards folder
where exported_dashboard.json is actually placed:
- name: 'default'
org_id: 1
folder: ''
type: 'file'
options:
folder: '/var/lib/grafana/dashboards'
[Optional] Then you also can configure default datasourse in provisioning/datasources/all.yml, prometheus, for example:
datasources:
- access: 'proxy'
editable: true
is_default: true
name: 'prom1'
org_id: 1
type: 'prometheus'
url: 'http://prometheus:9090'
version: 1
Finally, docker-compose.yml:
version: '3.8'
services:
grafana:
image: awesome-grafana:latest
build:
context: grafana
ports:
- "3000:3000"
environment:
GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: "/var/lib/grafana/dashboards/exported_dashboard.json"
As for HOME dashborad, you can use the GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH evironment variable, as shown above.
More about GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH evironment variable you can read in that github issue.
The full comprehensive code example you can find in the next github repository
Original article with explanation there.

json data stripe webhook

Im trying to implement stripe webhooks in my rails app. The webhook send this json data.
{ "created": 1326853478, "livemode": false, "id": "evt_00000000000000", "type": "invoice.payment_succeeded", "object": "event", "request": null, "pending_webhooks": 1, "api_version": "2017-06-05", "data": {
"object": {
"id": "in_00000000000000",
"object": "invoice",
"amount_due": 500,
"application_fee": null,
"attempt_count": 1,
"attempted": true,
"charge": "_00000000000000",
"closed": true,
"currency": "usd",
"customer": "cus_00000000000000",
"date": 1501950408,
"description": null,
"discount": null,
"ending_balance": 0,
"forgiven": false,
"lines": {
"data": [
{
"id": "sub_BLXcTSekdHflq5",
"object": "line_item",
"amount": 500,
"currency": "usd",
"description": null,
"discountable": true,
"livemode": true,
"metadata": {
},
"period": {
"start": 1507246341,
"end": 1509924741
},
"plan": {
"id": "Subscriber",
"object": "plan",
"amount": 500,
"created": 1501901993,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {
},
"name": "Subscriber",
"statement_descriptor": "WatchBuddie Stream sub",
"trial_period_days": null
},
"proration": false,
"quantity": 1,
"subscription": null,
"subscription_item": "si_1AyqWnFr5iCt1Tv7n23zDLOM",
"type": "subscription"
}
],
"total_count": 1,
"object": "list",
"url": "/v1/invoices/in_1AnV6yFr5iCt1Tv7PnqZ0EUA/lines"
},
"livemode": false,
"metadata": {
},
"next_payment_attempt": null,
"paid": true,
"period_end": 1501950408,
"period_start": 1501950408,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"subscription": "sub_00000000000000",
"subtotal": 500,
"tax": null,
"tax_percent": null,
"total": 500,
"webhooks_delivered_at": 1501950409
} } }
webhook method
def webhooks
begin
event_json = JSON.parse(request.body.read)
event_object = event_json['data']['object']
#refer event types here https://stripe.com/docs/api#event_types
case event_json['type']
when 'invoice.payment_succeeded'
#Update the total subscription total
#Send in email to the user telling them that they resubbed
logger.debug event_object['lines']['id']
end
My question is how do I get the "id": "sub_BLXcTSekdHflq5" I tried
logger.debug event_object['lines']['id']
It doesn't seem to be working what am I doing wrong? I'm sure its just a syntax thing that I am not understanding.
Thanks for all the help!
Figured it out the lines data was in a hash so you had to iterate over it. This is what I did for anyone who comes across this.
event_object['lines']['data'].each{ |i|
sub_id = i['id']
logger.debug sub_id
}

How do I create (or update) a QBO BillPayment so that it has an unapplied payment amount?

I created a bill through the QuickBooks Online (QBO) web UI. Then I queried using the API (v3, documented here). The response:
{
"SyncToken": "16",
"domain": "QBO",
"VendorRef": {
"name": "MyVendor",
"value": "237"
},
"TxnDate": "2014-12-07",
"TotalAmt": 1.83,
"CurrencyRef": {
"name": "United States Dollar",
"value": "USD"
},
"PayType": "Check",
"PrivateNote": "test billpayment description (mod)",
"sparse": false,
"Line": [
{
"Amount": 1.22,
"LinkedTxn": [
{
"TxnId": "1412",
"TxnType": "Bill"
}
]
}
],
"Id": "1413",
"CheckPayment": {
"PrintStatus": "NeedToPrint",
"BankAccountRef": {
"name": "MyBankAcct#1234",
"value": "137"
}
},
"MetaData": {
"CreateTime": "2014-12-07T18:44:51-08:00",
"LastUpdatedTime": "2014-12-10T20:20:28-08:00"
}
}
As you can see, it has $0.61 of the TotalAmt unapplied to any Bills. (The other $1.22 is applied to Bill 1412.) Now, when I try to update this bill to change JUST the amount applied to the linked transaction, I get unexpected results.
Here's the update request body:
{
"SyncToken": "16",
"domain": "QBO",
"VendorRef": {
"name": "MyVendor",
"value": "237"
},
"TxnDate": "2014-12-07",
"TotalAmt": 1.83,
"CurrencyRef": {
"name": "United States Dollar",
"value": "USD"
},
"PayType": "Check",
"PrivateNote": "test billpayment description (mod)",
"sparse": false,
"Line": [
{
"Amount": 1.21,
"LinkedTxn": [
{
"TxnId": "1412",
"TxnType": "Bill"
}
]
}
],
"Id": "1413",
"CheckPayment": {
"PrintStatus": "NeedToPrint",
"BankAccountRef": {
"name": "MyBankAcct#1234",
"value": "137"
}
},
"MetaData": {
"CreateTime": "2014-12-07T18:44:51-08:00",
"LastUpdatedTime": "2014-12-10T20:20:28-08:00"
}
}
In the response, it appears that the API just basically can't handle the situation (even though it clearly existed when I created it in the web UI). Look what happens to the TotalAmt attribute! It's reduced to whatever the payment was in the LinkedTxn:
{
"BillPayment": {
"VendorRef": {
"value": "237",
"name": "MyVendor"
},
"PayType": "Check",
"CheckPayment": {
"BankAccountRef": {
"value": "137",
"name": "MyBankAcct#1234"
},
"PrintStatus": "NeedToPrint"
},
"TotalAmt": 1.21,
"domain": "QBO",
"sparse": false,
"Id": "1413",
"SyncToken": "17",
"MetaData": {
"CreateTime": "2014-12-07T18:44:51-08:00",
"LastUpdatedTime": "2014-12-10T20:25:02-08:00"
},
"TxnDate": "2014-12-07",
"CurrencyRef": {
"value": "USD",
"name": "United States Dollar"
},
"PrivateNote": "test billpayment description (mod)",
"Line": [
{
"Amount": 1.21,
"LinkedTxn": [
{
"TxnId": "1412",
"TxnType": "Bill"
}
]
}
]
},
"time": "2014-12-10T20:25:01.91-08:00"
}
I don't see discussion of this on the known issues page, so I'm pretty confused.
If you have any suggestions as to how to get this to do what I want it to, I thank you for your thoughts!

Resources