Are semicolons allowed in device attributes? - fiware-orion

I was trying to update an entity with a semicolon inside an attribute:
{
"name": "Accelerometer",
"type": "string",
"value": "0;0;0",
"metadatas": [
{
"name": "TimeInstant",
"type": "ISO8601",
"value": "2019-12-17T14:13:01.398Z"
}
]
}
and got
{
"errorCode": {
"code": "400",
"reasonPhrase": "Bad Request",
"details": "Illegal value for JSON field"
}
}
Removing the ; solve the error. However, is this behaviour the one expected?
Thanks

Yes, that's normal behavior. Please have a look to the forbidden characters Orion documentation.

Related

PowerBI REST API - Failed to create a new datasource on the specified gateway

I'm following this page in order to create a new PowerBI datasource.
And used this kind of body for the POST request:
{
"connectionDetails": "{\"server\":\"aaa\",\"database\":\"bbb\"}",
"credentialDetails": {
"credentialType": "Basic",
"credentials": "{\"credentialData\":[{\"name\":\"username\", \"value\":\"ccc\"},{\"name\":\"password\", \"value\":\"XoZT6aM1r0puO\"}]}",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "RSA-OAEP",
"privacyLevel": "None",
"useEndUserOAuth2Credentials": "False"
},
"datasourceName": "ddd",
"dataSourceType": "Sql"
}
But getting the below error for the POST request:
{
"error": {
"code": "DM_GWPipeline_UnknownError",
"pbi.error": {
"code": "DM_GWPipeline_UnknownError",
"parameters": {},
"details": [
{
"code": "DM_ErrorDetailNameCode_UnderlyingErrorMessage",
"detail": {
"type": 1,
"value": "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "
}
},
{
"code": "DM_ErrorDetailNameCode_UnderlyingHResult",
"detail": {
"type": 1,
"value": "-2146233033"
}
}
]
}
}
}
Any advice would be appreciated!
Thanks in advance.
BTW, as an alternative I would be happy to know if there is a powershell code that was found as working.

AWS CloudFormation Parameter values specified for a template which does not require them

I porting code from ruby to Python for CloudFormation stack creation projects. Below is a stack that I just keep getting 'Parameter values specified for a template which does not require them.'
This really doesn't tell me anything.
I have checked the json against the schemas and all was ok, and checked against the stack created by the original code and it matches, so can someone see an issue here, or at least point me in the right direction.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "EcsStack-5ad0c44afbf508d0b5a158df0da307fca33f5f63",
"Outputs": {
"marc1EcsCluster": {
"Value": {
"Ref": "marc1EcsCluster"
}
},
"marc1EcsClusterArn": {
"Value": {
"Fn::GetAtt": [
"marc1EcsCluster",
"Arn"
]
}
}
},
"Parameter": {
"Vpc": {
"Description": "VPC ID",
"Type": "String"
}
},
"Resources": {
"CloudFormationDummyResource": {
"Metadata": {
"Comment": "Resource to update stack even if there are no changes",
"GitCommitHash": "5ad0c44afbf508d0b5a158df0da307fca33f5f63"
},
"Type": "AWS::CloudFormation::WaitConditionHandle"
},
"marc1EcsCluster": {
"Type": "AWS::ECS::Cluster"
}
},
"Transform": "AWS::Serverless-2016-10-31"
}
As more general advice, the CloudFormation Linter will catch these errors with messages like:
E1001: Top level item Parameter isn't valid
template.json:19

ElasticSearch Reindex API and painless script to access date field

I try to familiarize myself with the Reindexing API of ElasticSearch and the use of Painless scripts.
I have the following model:
"mappings": {
"customer": {
"properties": {
"firstName": {
"type": "text",
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
}
},
"lastName": {
"type": "text",
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
}
},
"dateOfBirth": {
"type": "date"
}
}
}
}
I would like to reindex all documents from test-v1 to test-v2 and apply a few transformations on them (for example extract the year part of dateOfBirth, convert a date value to a timestamp, etc) and save the result as a new field. But I got an issue when I tried to access it.
When I made the following call, I got an error:
POST /_reindex?pretty=true&human=true&wait_for_completion=true HTTP/1.1
Host: localhost:9200
Content-Type: application/json
{
"source": {
"index": "test-v1"
},
"dest": {
"index": "test-v2"
},
"script": {
"lang": "painless",
"inline": "ctx._source.yearOfBirth = ctx._source.dateOfBirth.getYear();"
}
}
And the response:
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"ctx._source.yearOfBirth = ctx._source.dateOfBirth.getYear();",
" ^---- HERE"
],
"script": "ctx._source.yearOfBirth = ctx._source.dateOfBirth.getYear();",
"lang": "painless"
}
],
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"ctx._source.yearOfBirth = ctx._source.dateOfBirth.getYear();",
" ^---- HERE"
],
"script": "ctx._source.yearOfBirth = ctx._source.dateOfBirth.getYear();",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Unable to find dynamic method [getYear] with [0] arguments for class [java.lang.String]."
}
},
"status": 500
}
According to this tutorial Date fields are exposed as ReadableDateTime so they support methods like getYear, and getDayOfWeek. and indeed, the Reference mentions those as supported methods.
Still, the response mentions [java.lang.String] as the type of the dateOfBirth property. I could just parse it to e.g. an OffsetDateTime, but I wonder why it is a string.
Anyone has a suggestion what I'm doing wrong?

REST How can I combine search entity and attributes at the same time

Hello Everyone I hate these entities in REST
{
"id": "Church-MX-1",
"type": "PointOfInterest",
"category": {
"type": "Text",
"value": "Church",
"metadata": {}
},
"location": {
"type": "geo:point",
"value": "19.435433, -99.133072",
"metadata": {}
},
"name": {
"type": "Text",
"value": "Catedral Metropolitana",
"metadata": {}
},
"postalAddress": {
"type": "StructuredValue",
"value": {
"addressCountry": "MX",
"addressLocality": "México Ciudad de México",
"addressRegion": "Ciudad de México"
},
"metadata": {}
},
"source": {
"type": "Text",
"value": "http://www.arquidiocesismexico.org.mx",
"metadata": {}
}
},
What i want to do is to perform a query using Insomnia where i can get type = PointOfInterest AND also by "name"."value" = "Catedral Metropolitana".
How can I do this?
I tried this query but is not working:
http://148.205.176.167:1026/v2/entities?limit=100&type=PointOfInterest&name=%22Catedral%20Metropolitana%22
It is not working because it displays all PointOfInterest and not only the one with name "Catedral Metropolitana".
I tried to find resources on queries in REST but just found the requests and nothing on how to query entities.
I hope someone can help me please. I will keep searching.
Thanks In Advance.
I found the solution:
NGSIv2 Documentation
Have to use the right operators for it, according to Simple Query Standard.
So the query for this is:
http://148.205.176.167:1026/v2/entities?type=PointOfInterest&q=name~%3DBellas%20Artes
name like Bellas Artes is q=name~=Bellas Artes and insomnia does the url Encoding.

Querying application stats with aggregate by

I am migrating code to v2.2 of the API and need to separate the clicks/impressions between unique and non unique.
The API docs ask us to pass count and uu as values for the aggregateBy modifier which if i pass uu it returns an error->
/v2.2/appid12345/app_insights/story_impressions?aggregateBy=uu
{
"error": {
"message": "(#100) Param aggregateBy must be one of {COUNT, USERS, TOPK, SUM, USD_SUM, UNKNOWN_USERS}",
"type": "OAuthException",
"code": 100
}
}
But if i pass USERS as the error message states i get json returned
/v2.2/appid12345/app_insights/story_impressions?aggregateBy=USERS
{
"data": [
{
"time": "2015-01-15T08:00:00+0000",
"value": "56"
},
{
"time": "2015-01-16T08:00:00+0000",
"value": "128"
},
{
"time": "2015-01-17T08:00:00+0000",
"value": "196"
},
{
"time": "2015-01-18T08:00:00+0000",
"value": "420"
},
{
"time": "2015-01-19T08:00:00+0000",
"value": "304"
},
{
"time": "2015-01-20T08:00:00+0000",
"value": "176"
},
{
"time": "2015-01-21T08:00:00+0000",
"value": "128"
}
]
}
My questions is- can i assume the USERS value with the modifier returns the unique count? and the COUNT values returns the non unique?
Its been reported to facebook as a bug
https://developers.facebook.com/bugs/412068288957160/