not being able to add dynamic expression to .json - azure-data-factory

do you see why I see the error when using the #guid() inside the below .json in the web activity of data factory
[
{
"id":#{guid()}
, "subject": "data/company"
, "topic": null, "eventType": "statusupdated"
, "eventTime": "2022-07-26T09:41:00.9584103Z", "data": { "firstName": "testname", "salary": "test" }, "dataVersion": "1.0", "metadataVersion": null
}
]
error when debug is run:
{"error":{"code":"InvalidRequestContent","message":"The request content is not valid and could not be deserialized: 'Unexpected character encountered while parsing value: b. Path '[0].id', line 2, position 5.'."}}

As the error message The request content is not valid and could not be deserialized: 'Unexpected character encountered while parsing value: b. Path '[0].id', line 2, position 5 indicates, the issue is with the content.
While parsing the JSON, it encountered an unexpected character. This is because of the value of the key id that is #{guid()}. You can validate the json using this third-party validator which indicates the same.
The main issue is the incorrect usage of String Interpolation (#{...}). This feature is used when we need to utilize pipeline expressions inside a string.
But here you have used it directly inside a json as a value for key (id). You can try correcting this by enclosing #{guid()} inside Double quotes ("") to make it a valid JSON (can be checked using the above third-party validator) as shown below:
[
{ "id": "#{guid()}" , "subject": "data/company" , "topic": null, "eventType": "statusupdated" , "eventTime": "2022-07-26T09:41:00.9584103Z", "data": { "firstName": "testname", "salary": "test" }, "dataVersion": "1.0", "metadataVersion": null }
]

Related

SendGrid v3 Api dynamic template_id not recognised, won't send

I am trying to send a simple password reset email that's defined in a dynamic template. I have tested the template within SendGrid and it works fine. I have copied and pasted the template_id from the website, checked and double-checked it, but trying to post this message:
{
"personalizations": [
{
"to": [
{
"email": "chairman###########.org.uk"
}
],
"dynamic_template_data": {
"firstname": "Tim",
"url": "https://localhost:5001/account/ProcessPasswordReset?id=4&code=############"
},
"send_at": 0
}
],
"from": {
"email": "membership###########.org.uk",
"name": "A Person"
},
"reply_to_list": [],
"subject": "Password Reset",
"content": [],
"template_id": "d-23a2c68a9e5349488be23299a04a9485",
"send_at": 0
}
I get the following response
{
"errors": [
{
"message": "Unless a valid template_id is provided, the content parameter is required. There must be at least one defined content block. We typically suggest both text/plain and text/html blocks are included, but only one block is required.",
"field": "content",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.content"
}
]
}
As far as I can tell from the documentation, this is a well-formed message with a correct template_id.
Ok so the problem was the empty
"content": [],
This must not be sent at all if there is no content to send. Working as expected now this is removed.

PingOne /attributes endpoint throwing error for multiple valued body

I was trying to add few new attributes to a PingOne application using this endpoint. Since it doesn't support any kind of powershell I am trying to add values using the /environments/{{sourceEnvID}}/applications/{{appID}}/attributes endpoint with the help of Invoke-RestMethod. It works for a body having only one value. If I am passing multiple values as an array it is throwing an error of malformed data/Invalid data.
For example: the below body works
{
"name": "email",
"update": "EMPTY_ONLY",
"value": "${providerAttributes.email}"
}
, but if we pass a body having the below structure it gets failed.
[
{
"name": "email",
"update": "EMPTY_ONLY",
"value": "${providerAttributes.email}"
},
{
"name": "profile",
"update": "EMPTY_ONLY",
"value": "${providerAttributes.profile}"
}
]
Any help would be appreciated.

AppSync resolver: Trailing characters at the end of the JSON string are not allowed

When creating a custom AppSync resolver, it is saved and well deployed but when I request the API I get this response.
I have absolutely no chars after the last bracket. What's wrong ?
{
"data": null,
"errors": [
{
"path": [
"listUsers"
],
"data": null,
"errorType": "MappingTemplate",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 3,
"sourceName": null
}
],
"message": "Trailing characters at the end of the JSON string are not allowed."
}
]
}
My bad, I only had a duplicate bracket in my mapping template. The console doesn't tell anything for these cases and you only have the error at runtime.
I can confirm that this error happens when a rogue character in your Velocity template.
Somehow I copied and pasted the template into my cloud formation template with a curly bracket at the end.
Thanks to this question I found it.

Create large text field in Eloqua using REST API

I was trying to create custom object and corresponding fields in Eloqua. While creating a field with datatype largeText it throws validation error. I can create fields with datatypes like date, text, numeric etc. How can I create largeText fields?
This is my request body
{
"type": "CustomObject",
"description": "TestObject",
"name": "TestObject",
"fields": [
{
"type": "CustomObjectField",
"name": "Description",
"dataType": "largeText",
"displayType": "text"
}
]
}
Response is [Status=Validation error, StatusCode=400]
You should use "displayType":"textArea"for creating largeText fields.

GoodData "Create Report Definition" API Call giving 500 Internal Server Error

I'm trying to create a report definition using the GoodData REST API. I use the following endpoint to invoke the rest call.
"/gdc/md/{project-id}/obj"
When i try to invoke the API call with the following dataset in which the projectId and the userId are valid, it gives me the error with the response code 500.
{
"reportDefinition": {
"content": {
"filters": [],
"format": "grid",
"grid": {
"rows": [],
"columns": [
"metricGroup"
],
"sort": {
"columns": [],
"rows": []
},
"columnWidths": [],
"metrics": [
{
"uri": "/gdc/md/qy48iv4flikdlcwpwioizuip74wt8nb5/obj/63f3cecd2a8d3ce2ec9378381c8f39e3",
"alias": ""
}
]
}
},
"meta": {
"title": "Sample report definition",
"summary": "This is a sample report",
"tags": "",
"deprecated": 0,
"category": "samplecategory"
}
}
}
{
"error": {
"message": "Internal server error. Please fill in bug report with request_id='lp78FL5S1IPMqB2n'"
}
}
I'm certain that the user project_id and the user_id are valid. Is this an error in the API?
Thank you in advance.
Apart from the metrics URI that looks weird (hash instead of numeric ID), I was able to dig in our logs an error that says: "Category is not equal to tag structure".
In your example you have its value set to "samplecategory". "category" property defines what type of object are you creating. If you are creating a report definition it should have value of "reportDefinition".
Last time I worked with GoodData API, metrics had numeric IDs. That seems most likely to be the culprit. Where did you get "/gdc/md/qy48iv4flikdlcwpwioizuip74wt8nb5/obj/63f3cecd2a8d3ce2ec9378381c8f39e3" from, especially the "63f3cecd2a8d3ce2ec9378381c8f39e3" part?