Not able to retrieve results from Open TSDB via HTTP - http

I have set up open TSDB using docker image. I am able to push data to database via HTTP post request.
[{
"metric": "sys.cpu.nice",
"timestamp": 1567764102,
"value": 18,
"tags": {
"host": "web01",
"dc": "lga"
}
},
{
"metric": "sys.cpu.abc",
"timestamp": 1567764602,
"value": 9,
"tags": {
"host": "web02",
"dc": "lga"
}
}
]
Same data is also visible on the portal but I want to retrieve this data form TSDB by API.
I used this but it's not returning actual data.
http://localhost:4242/api/search/lookup?m=sys.cpu.nice{host=*}
{
"type": "LOOKUP",
"metric": "sys.cpu.nice",
"tags": [{
"key": "host",
"value": "*"
}],
"limit": 25,
"time": 6.0,
"results": [],
"startIndex": 0,
"totalResults": 0
}
Could you please help to get data back from the database. I need to send this data to some other system.

Try using the /api/query endpoint
In your case you could try one of the following GET requests:
http://localhost:4242/api/query?m=sum:cmp.sys.db{host=server01,tenant01}&start=1h-ago
http://localhost:4242/api/query?m=zimsum:cmp.sys.db{host=server01,tenant01}&start=1h-ago

Related

Logic App > Cosmos PartitionKey Not Matching Error

I'm scared to put this out there because it should be so easy and I am facing the same issue as the post here, here and here and I have tried each of the answers to no avail. Below is the current Resulting Input (redacted) and Related CodeView of the inputs.
The Result
{
"method": "post",
"headers": {
"x-ms-documentdb-raw-partitionkey": "\"2020\""
},
"path": "/dbs/xxxx/colls/smtp/docs",
"host": {
"connection": {
"name": "/subscriptions/..."
}
},
"body": {
"category": [
[
"cat facts"
]
],
"email": "example#test.com",
"event": "processed",
"id": "yada",
"partitionKey": "\"2020\"",
"sg_event_id": "yada yada",
"sg_message_id": "yada",
"smtp-id": "yada",
"timestamp": 1604345542
}
}
The Code View
{
"inputs": {
"body": {
"category": [
"#items('For_each')['category']"
],
"email": "#items('For_each')['email']",
"event": "#items('For_each')['event']",
"id": "#items('For_each')['sg_message_id']",
"partitionKey": "\"#{formatDateTime(utcNow(),'yyyy')}\"",
"sg_event_id": "#items('For_each')['sg_event_id']",
"sg_message_id": "#items('For_each')['sg_message_id']",
"smtp-id": "#items('For_each')['smtp-id']",
"timestamp": "#items('For_each')['timestamp']"
},
"headers": {
"x-ms-documentdb-raw-partitionkey": "\"#{formatDateTime(utcNow(),'yyyy')}\""
}
}
The error I'm getting is the usual one - PartitionKey extracted from document doesn't match the one specified in the header
I just can't see what I'm missing here now.
Thanks all.
First, as Matias comments, check your partition key path.
Then, change this code "partitionKey": "\"#{formatDateTime(utcNow(),'yyyy')}\"", to "partitionKey": "#{formatDateTime(utcNow(),'yyyy')}", in your document.
It works fine on my side:

TVRP API Authorization

I have successfully created an Bearer Token and i would like to request data from the Tour Planning/VRP API. However, i always get the following response: { "error": "Forbidden", "error_description": "These credentials do not authorize access" }
If i try to make the request with the APIKey instead of the Bearer Token, I don't get autenthification.
Authorization by token and apikey work fine for me, I have used it at the same time in other methods and it works fine. But none of these two authorization methods works:
POST https://vrp.api.here.com/v1/problems
Authorization: Bearer <My_Token>
or
POST https://vrp.api.here.com/v1/problems?apikey=My_ApiKey
with this Body:
{
"plan": {
"jobs": [
{
"id": "myJob",
"places": {
"delivery": {
"location": {"lat": 52.46642, "lng": 13.28124},
"times": [["2019-07-04T10:00:00.000Z","2019-07-04T12:00:00.000Z"]],
"duration": 180
}
},
"demand": [1]
}
]
},
"fleet": {
"types": [
{
"id": "myVehicle",
"profile": "normal_car",
"costs": {
"distance": 0.0002,
"time": 0.004806,
"fixed": 22
},
"shifts": [{
"start": {
"time": "2019-07-04T09:00:00Z",
"location": {"lat": 52.52568, "lng": 13.45345}
},
"end": {
"time": "2019-07-04T18:00:00Z",
"location": {"lat": 52.52568, "lng": 13.45345}
}
}],
"limits": {
"maxDistance": 300000,
"shiftTime": 28800
},
"capacity": [10],
"amount": 1
}
],
"profiles": [{
"name": "normal_car",
"type": "car",
"departureTime": "2019-07-04T09:15:00Z"
}]
}
}
Thanks Jose
You are probably using your Freemium account, which does not include access to the Tour Planning API at this point. We are working on an update for the developer portal that will make it more clear which APIs are included. If you need access please use the contact us form on the developer portal to reach out to a HERE representative.

Getting all profiles from Google Analytics API

I'm trying to get all profiles using ~all option with this endpoint
https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles
It doesn't return all profiles due to ~all for accounts. If I include account ID instead of ~all, then it returns profiles based on that account id - which are missing when used with ~all option.
https://www.googleapis.com/analytics/v3/management/accounts/89478503/webproperties/~all/profiles
Am I doing something wrong or is this GA API bug?
I sugst you look into using account summaries list
GET https://www.googleapis.com/analytics/v3/management/accountSummaries
This will return all the account information for a user.
{
"kind": "analytics#accountSummaries",
"username": "me#gmail.com",
"totalResults": 15,
"startIndex": 1,
"itemsPerPage": 1000,
"items": [
{
"id": "59183475",
"kind": "analytics#accountSummary",
"name": "Cube Analytics",
"webProperties": [
{
"kind": "analytics#webPropertySummary",
"id": "UA-59183475-1",
"name": "Cube Analytics",
"internalWebPropertyId": "93305066",
"level": "STANDARD",
"websiteUrl": "XXXXXXX",
"profiles": [
{
"kind": "analytics#profileSummary",
"id": "115455750",
"name": "Alaternate",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "97191919",
"name": "All Web Site Data",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "178538323",
"name": "MobileView",
"type": "APP"
}
]
}, ]
}
By using this call you should only need to make one call and get all of the information back.

How to check domain is verified using Google Analytics API?

I have used analytics.read in order to get user's sites and Google API response is:
{
"kind": "analytics#accountSummaries",
"username": "user#gmail.com",
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 1000,
"items": [
{
"id": "92159597",
"kind": "analytics#accountSummary",
"name": "MyNewDomain",
"webProperties": [
{
"kind": "analytics#webPropertySummary",
"id": "UA-92159597-1",
"name": "MyNewDomain",
"internalWebPropertyId": "236529827",
"level": "STANDARD",
"websiteUrl": "http://www.example.com",
"profiles": [
{
"kind": "analytics#profileSummary",
"id": "140745434",
"name": "All Web Site Data",
"type": "WEB"
}
]
}
]
}
]
}
Why there is no property related to domain status? How should I check whether domain is verified or not?
I tried to use siteverification scope for Google Verification API, it has the response that I need and it returns the list of verified domains but it has a scope of managing domains, so no one will actually grant access to our application in order to manage their domains and verify/un-verify domains.
Sample response:
{
"id": "string",
"site": {
"type": "string",
"identifier": "string"
},
"owners": [
"string"
]
}
How can I use analytics.read to get verified domains not unverified websites?

Usergrid: Queries not accepted in GET requests

Using Postman when I issue a get request to my Usergrid backend I get a response back. For example:
When I run:
https://api.usergrid.com/gss/sandbox/summaries
I get a response:
{
"action": "get",
"application": "6e9204f0-71da-11e4-9a58-bd53db9c149b",
"params": {},
"path": "/summaries",
"uri": "https://api.usergrid.com/gss/sandbox/summaries",
"entities": [
{
"uuid": "7cd5c98a-7b16-11e4-9085-b5397738dcd5",
"type": "summary",
"created": 1417629724184,
"modified": 1417629993800,
"accountId": "123123",
"accounts": [
{
"id": "123123",
"type": "Individual",
"category": "Prepaid",
"numberOfLines": 2,
"balance": {...
However when I run the request with a query:
https://api.usergrid.com/gss/sandbox/summaries?ql=select * where id=123123
I get :
"action": "get",
"application": "6e9204f0-71da-11e4-9a58-bd53db9c149b",
"params": {
"ql": [
"select * where id=123123"
]
},
"path": "/summaries",
"uri": "https://api.usergrid.com/gss/sandbox/summaries",
"entities": [],
"timestamp": 1418766878176,
"duration": 7,
"organization": "gss",
"applicationName": "sandbox",
"count": 0
I want to be able to get the complete response when I pass in an 'id' in the query as it is coming from my UI & get the response. Any ideas?
-S
Your id property is a sub-key of accounts - when dealing with objects, you can use dot notation to reference sub-keys, like account.id. Unfortunately in your case, because you're using an array ([]) of accounts in a single entity (not an {} object), those are not queryable. I did notice though that the same property exists under accountId. You could try:
https://api.usergrid.com/gss/sandbox/summaries?ql=select * where accountId=123123
If not, I'd recommend you look at using a new collection to maintain your list of accounts, and use connections to manage the relationships between the entities.

Resources