mailchimp "Segment test" error - json

im working on mailchimp api. i wanted to create a segment but before creating the segment i wanted to test the condition. so i tried this code
{
"apikey": "xxxxxx7e0992xxx1e3bdxxxe03axxx342-us3",
"list_id": "ec3d67c617",
"options": {
"match": "all",
"conditions": [
{
"field" : "testgrouptitle",
"op" : "all",
"value" : "testgroupname"
}
]
}
}
after firing this in postman(chrome) im getting this error
{
"status": "error",
"code": 506,
"name": "Invalid_Options",
"error": "op=\"all\" is invalid for field=\"testgrouptitle\" and value=\"testgroupname\"" }
the error might be the incorrect condition. can anyone tell me what wrong in the json code?
thanks in advance.

If you want to make a condition by Group:
Field = "interests-X": where X is the Grouping Id from lists/interest-groupings()
Valid Op(erations): one / none / all
Valid Values: a comma delimited string of interest groups for the list, just like you'd use in lists/subscribe() - see lists/interest-groupings()
For more information, refer to the documentation

Related

Selecting in States.StringToJson function

It there is a way to process the result of States.StringToJson intesic function directly ? 
Currently in a step function, I try to handle the error from another synchronous step function call :
"OtherStepFunction": {
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"StateMachineArn": "otherstepFunctionCall",
"Input.$": "$"
},
"End": true,
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Comment": "OtherStepFunctionFailed",
"Next": "StatusStepFunctionFailed",
"ResultPath": "$.error"
}
]
},
All errors goes in a pass flow named StatusStepFunctionFailed, with the errors output in $.error path.
The $.error is composed of the error type and the cause as an escapedJson string.
"error": {
"Error": "States.TaskFailed",
"Cause": "{\"ExecutionArn\":\"otherfunctionarm:executionid\",\"Input\":\"foooooo\"}"
}
Is there any way to extract only the ExecutionARN from this input ? In my pass step, I convert the Cause path as a json, but i didn't find a way to select directly the ExectionARN part. The following :
"reason.$": "States.JsonMerge($.error.Cause).ExecutionArn"
return The value for the field 'reason.$' must be a valid JSONPath or a valid intrinsic function call (at /States/HandleResource/Iterator/States/StatusStepFunctionFailedHandleJSON/Parameters)
My current workaround is to use 2 pass flow, first convert the output and then formating.
I had a similar issue.
What I did was create a task to put the Cause into a new path parameter using StringToJSON. I put that task as the next from the error and then called the subsequent task from that one.
Using your variable names and values:
In the Catch, change the Next from StatusStepFunctionFailed to parseErrorCause
Then parseErrorCause is like this:
"parseErrorCause": {
"Type": "Pass",
"Parameters": {
"Result.$": "States.StringToJson($.error.Cause)"
},
"ResultPath": "$.parsedJSON",
"Next": "StatusStepFunctionFailed"
},
And StatusStepFunctionFailed accesses
"Variable": "$.parsedJSON.Result.Input",
to get foooooo

Incompatible value for Quickbase Date Field

I have a feature where I update the values on Quickbase for our system.
I am able to update most fields, checkboxes, text inputs and numerical data..
using this kind of query
{
"to":"appid",
"data": [
{
"3": { "value": 1 },
"308": { "value": "2021-5-17" },
"104": { "value": true }
}
]
}
but when I try updating a value on a date field.. I get a '207 Multi-Status' response from it.
any idea how to set date values?
I tried different string formats. Quickbase formulas/functions like 'today()'
Thanks!
The format of your date is not quite correct. This API is very strict about the format YYYY-MM-DD so you should use "308": { "value": "2021-05-17" }. You can use some other keywords such as today for the value as described in the field type documentation. Also, if you are actually using the application Id for appId that will also cause problems since a table ID is expected there instead.
There could be other errors and the 207 Multi-Status code alone doesn't give much of a hint about what went wrong. If you can, look at the response body where you should see an error description returned from Quickbase that would look something like this:
{
"data": [],
"metadata": {
"createdRecordIds": [],
"lineErrors": {
"1": [
"Incompatible value for field with ID \"308\"."
]
},
"totalNumberOfRecordsProcessed": 1,
"unchangedRecordIds": [],
"updatedRecordIds": []
}
}

Testing an utterance: comparison to "published" produces JSON string completely different from results obtained by querying the API

I just trained my LUIS application and published it to production. If I test it on an utterance, I can see how that result compares to the published version and look at the JSON result. The problem is I'm getting a completely different JSON result there than I get when I query the API via its URL. Here is the test result JSON:
{
"query": "please show me *johnson*",
"prediction": {
"normalizedQuery": "please show me *johnson*",
"topIntent": "Show",
"intents": {
"Show": {
"score": 0.985523641
}
},
"entities": {
"ShowObject": [
"*johnson*"
],
"$instance": {
"ShowObject": [
{
"type": "ShowObject",
"text": "*johnson*",
"startIndex": 15,
"length": 9,
"score": 0.8382344,
"modelTypeId": 1,
"modelType": "Entity Extractor",
"recognitionSources": [
"model"
]
}
]
}
}
}
}
and here is the API query result:
{
"query": "please show me *johnson*",
"topScoringIntent": {
"intent": "Show",
"score": 0.985523641
},
"intents": [
{
"intent": "Show",
"score": 0.985523641
}
],
"entities": [
{
"entity": "* johnson *",
"type": "ShowObject",
"startIndex": 15,
"endIndex": 23,
"score": 0.8382344
}
]
}
The problem with the API query result is that it doesn't return enough information about the entity, and it returns a different entity than the test result. Note above that the test result returns *johnson* with no spaces near the asterisks, which is how the original query is, but the API query result returns * johnson * with spaces near the asterisks. I don't want it to put the spaces in, so I prefer the test result over the API query result.
Why are they different, and how do I get the API query to return a result like the test, i.e. with no modification of the input string to add spaces near the asterisks.
Here is the API query URL including parameters:
https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/[app ID removed]?q=please+show+me+*johnson*&timezoneOffset=0&verbose=true&spellCheck=false&staging=false
Oh, I see now - this is probably to represent a wildcard search, right? If so, I'm not personally aware of a way to strip this out of a LUIS response, and I've seen similar, I think, when there's an #mention in there as well. However, if this is to facilitate searches, such that you know there's a good chance to have a * before and/or after the "ShowObject" entity, then it should be easy enough to test for this and replace, either string or regex (replace the "star-plus-space" with a space, I mean - I realise you need the star itself). Basically, you'd replace "[start][space]" with "[start]", and same at the end. Not pretty, but workable and simple to implement...
Just out of interest, do you anticipate * in the middle of a string as well?

LUIS Import Dataset: BadArgument: Dataset object cannot be null. Parameter name: dataSet

Good day community, I am using LUIS to train a data set to let it classified between different meaning of the words. After I've done trained, I want to import a set of data to let it test. There is a batch testing options for me to import a json file, however it keeps showing this error:
BadArgument: Dataset object cannot be null. Parameter name: dataSet
I have already follow the json format that it gave which is like this:
[
{
"text": "hey dad, are you hungry?",
"intent": "None",
"entities":
[
{
"entity": "FamilyMember",
"startPos": 4,
"endPos": 6
}
]
},
{
.
.
.
}
]
My json file has the format like this:
[
{
"text" : "Hello"
"intent": "Greetings"
},
{
"text" : "I want bread"
"intent": "Request"
}
]
Can anyone tell me what am I doing wrong? The training doesn't include any entities so I did not put it into my json file.
Thank you.
You still need to provide the entities attribute and give it an empty array, otherwise you'll receive a different error. Regarding your format, you're missing commas after your text attributes.
[
{
"text" : "Hello",
"intent": "Greetings",
"entities": []
},
{
"text" : "I want bread",
"intent": "Request",
"entities": []
}
]
When I used the above code the batch test successfully completed for me.

Parsing through JSON .. Gives undefined?

I have a very complex JSON and a snippet of it is below:
var designerJSON=
{
"nodes":
[
{
"NodeDefinition": {
"name": "Start",
"thumbnail": "Start.png",
"icon": "Start.png",
"info": "Entry point ",
"help": "Start point in your workflow.",
"workflow ": "Start",
"category": "Basic",
"ui": [
{
"label": "Entry point",
"category": "Help",
"componet": "label",
"type": "label"
}
]
},
"States": [
{
"start": "node1"
}
]
},.......
]
}
I would like to get the value of "start" in States. But I am stuck in the first step of entering into JSON. When I try
console.log(designerJSON["nodes"]);
I am getting Undefined.
I want the value of start. Wich is designerJSON["nodes"]["States"]["start"].
Can you help.
Thanks in advance
designerJSON["nodes"]["States"]["start"] won't do it.
designerJSON["nodes"] is a list, as is States, so you need to access individual items by index (or iteration).
In the example you have given you need to use this:
designerJSON['nodes'][0]['States'][0]['start']
or this (cleaner IMO):
designerJSON.nodes[0].States[0].start
You have an array in JSON.
instead of
designerJSON["nodes"]["States"]["start"]
use
designerJSON["nodes"][0]["States"][0]["start"]
ps. pay attention on how code is formatted in the topic.
pps. using brackets for accessing properties in js is "bad style" (due to js hint recommendations). better access those via dot, e.g:
designerJSON.nodes[0].States[0].start