I am receiving the following error:
curl -i -k -X POST “https://eval.example.com/translate/v1?lang=de” -H “Content-Type:application/json” -d ‘{ “text”: “Hello world!” }’
HTTP/2 500
content-type: application/json
x-request-id: aec401f7-8e23-4768-b6fb-d02c5a4152a6
content-length: 121
date: Thu, 18 May 2023 21:41:46 GMT
via: 1.1 google
alt-svc: h3=“:443”; ma=2592000,h3-29=“:443”; ma=2592000
{“fault”:{“faultstring”:“Unresolved variable : $.text,JsonRequest”,“detail”:{“errorcode”:“entities.UnresolvedVariable”}}}
For following script:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> language {firstnonnull(request.queryparam.lang,propertyset.language.output)} JsonRequest request.content text {jsonPath($.text,JsonRequest)} {"q":"{text}","target":"{language}"} POSTNot sure what went wrong and how to resolve this. Tried many possibilities but since it is part of a quest, we have to follow the below instructions and should create accordingly.
- An AssignMessage policy named AM-BuildTranslateRequest should be used to create the backend request used in the translate conditional flow.
-
Use an AssignVariable with a template to create variables which will be used later in a logged message. The variable named text should use the jsonPath message template function to extract the text field from the request.
-
The variable named language should be created by using the firstnonnull message template function. This variable should contain the lang query parameter value if it exists, and the language property set’s output property for the target language if the lang query parameter has not been specified.
-
A Set section should be used to set the JSON payload required by the backend service. Both variables you have created will be used in the payload.
