Author Message
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
Hi,

Am trying to invoke rest service from engagement designer and am receiving error saying that Schema is not valid and "Input Schema: Properties are not defined."


input schema shows as: {"title":"RestServiceInputSchema","properties":{},"type":"object"}
output schema shows as: {"title":"RestServiceOutputSchema","properties":{"responseCode":{"type":"string"},"responsePayload":{"type":"string"},"responsePayloadType":{"type":"string"}},"type":"object"}
and url is: http://localhost:8080/test?phoneNumber=1234


how do i get rid of the above error and change the input and output schema to custom fileds and values.
RajeshChandrashekar
Joined: Oct 27, 2016
Messages: 60
Offline
Hi let us try to help you here,

REST task you would get properties not defined when you dont have any query params in the request and click input mapping.
For your URL http://localhost:8080/test?phoneNumber=1234 , if you want the phone number to be dynamic and use mapping

provide the url as: http://localhost:8080/test?phoneNumber={phoneNumber}
And then click on input mapping and you can map the value.

Thanks, hope this helps.
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
hi thanks for the reply.

now i the error has gone for the input mapping.


and output schema is generated as below how can I add the custom fileds here what am receiving as response. i am not able to edit the schema.

{"title":"RestServiceOutputSchema","properties":{"responseCode":{"type":"string"},"responsePayload":{"type":"string"},"responsePayloadType":{"type":"string"}},"type":"object"}

the below phone number is what dialed by user and which system variable of call_intercept i can get the caller dialed number to map the variable phoneNumber in input Mapping.

http://localhost:8080?phoneNumber={phoneNumber}
RajeshChandrashekar
Joined: Oct 27, 2016
Messages: 60
Offline
Hi,

For your question :
and output schema is generated as below how can I add the custom fileds here what am receiving as response. i am not able to edit the schema.

{"title":"RestServiceOutputSchema","properties":{"responseCode":{"type":"string"},"responsePayload":{"type":"string"},"responsePayloadType":{"type":"string"}},"type":"object"}


[Rajesh:] you can read the data from the responsPayload , this has the complete response sent from the service. The response payload type for example says its json or xml etc.


the below phone number is what dialed by user and which system variable of call_intercept i can get the caller dialed number to map the variable phoneNumber in input Mapping.

http://localhost:8080?phoneNumber={phoneNumber}

[Rajesh:] assuming you are using breeze callIntercepted family, you can read it from handle string from calledParty object.


rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
hi,

regarding the response format it's JSON and the service definition only available as of now. you mean only when the full service is available i will be able to retreive the same and edit in output schema?
The JSON response definition as below.

{phoneNumberOne={String}, phoneNumberTwo={String}}

so the filed "handle" of object "calledPatry" will give the value entered by the caller party right?
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
The JSON response definition as below.

{phoneNumberOne={String}, phoneNumberTwo={String}}
RajeshChandrashekar
Joined: Oct 27, 2016
Messages: 60
Offline

Post 10/04/2017 02:04:26 Subject: Re:engagement designer rest api invocation
hi,

regarding the response format it's JSON and the service definition only available as of now. you mean only when the full service is available i will be able to retreive the same and edit in output schema?
The JSON response definition as below.

{phoneNumberOne={String}, phoneNumberTwo={String}}


I think you can not edit the output schema , i may need to check with my team mate in different time zone. But you can read the payload in expression like for example JSON.parse(payload).some_field


so the filed "handle" of object "calledPatry" will give the value entered by the caller party right?

Yes the handle of calledParty object would contain the called party number
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
Can i use the below way to read the fileds from the JSON response.

JSON.parse(RestServiceOutputSchema["responsePayload"]).returnCode
RajeshChandrashekar
Joined: Oct 27, 2016
Messages: 60
Offline
hi,
you can map the output of the REST task to a variable and can read as below

JSON.parse(reponseVar["payloadStr"]).returnCode

So i have created a variable called responseVar and string under that called payloadStr, map the output of rest task payload to this variable
, returnCode comes in your payload right ?
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
Hi,

please confirm me if the below approach is correct.

responsePayload:string is the complete response from the rest web service call.

Created custom variable name "restResponseData" with the mapping filed "Data" and assigned the responsePayload to filed "Data".

After that created the Assign element in work flow for pasring the data.

returnCode is the customer output error code from the rest service.

JSON.parse(restResponseData["Data"]).returnCode

responseCode:string from the rest web service will give us the HTTP status code for the rest client call?
RajeshChandrashekar
Joined: Oct 27, 2016
Messages: 60
Offline
So the REST task has 3 things in output
1)responseCode:string
2)responsePayload:string
3)responsePayloadType:string

So you can read the responseCode:string to get the status code.

If you need anything from the payload then you can use as mentioned

responsePayload:string is the complete response from the rest web service call.

Created custom variable name "restResponseData" with the mapping filed "Data" and assigned the responsePayload to filed "Data".

After that created the Assign element in work flow for pasring the data.

returnCode is the customer output error code from the rest service.

JSON.parse(restResponseData["Data"]).returnCode
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
hi,

when i use assign to parse the response assign is saying you should have some Int or String as input while creating the element. do we have any other state in work flow to do these kind of operations like business logic or data parsing etc.
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
if i want to write condition i will use exclusive gateway and write the condition on the lable. but this is restricted to only one if and else. if developer wants to implement if/elseif/else then which gateway we should use? or we need to use if-else and in else write another if etc..
rajgari
Joined: Dec 19, 2016
Messages: 16
Offline
Hi,

can someone answer the above pending queries.
Go to:   
Mobile view