Question
Reply S.P.A.
IT
Last activity: 2 Jan 2020 3:58 EST
Issue mapping JSON request
Hi,
I've this particular issue mapping json attribute of a REST service I expose.
For example, this is the request that I receive:
{
"step": 1
}
and this is the response I want to send:
{
"step" : 2
}
In Pega, my property is "Step", and I've set pzExternalName to "step". This work for the response, but the request can't map "step" json value in my property, that results blank.
Tracing the service, it create a Page with a property named "step" and not "Step" as I expected. Any suggestion? What I'm doing wrong?
Thanks in advance.
-
Likes (1)
Chinmaya Kumar Baral -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
IN
Hi NicolaG,
Yes, You should use same property which is present in request Json i.e 'step'.It will work.Please mark this post as helpful/correct if it helped you.
Thanks,
Abhinav
Pegasystems Inc.
IN
Hi NicolaG,
I need more information to share my inputs.Can you please share complete class structure & service Rest screenshot.Where did you create request and response class.
Please share URI template.I will try to replicate it at my end & let you know how it works.
Thanks,
Abhinva
Pegasystems Inc.
IN
Hi NicolaG,
You need to create a Datatype,Let's say "JSONRequest". Pega will create a corresponding class for that like orgName-AppName-Data-JSONRequest.
Create the same properties that exists in request.
In connect Rest ,Select Map to as JSON & map to key as this JSONRequest.It will do mapping of request.
Thanks,
Abhinav
Reply S.P.A.
IT
Thanks Abhinav7,
I've done exactly what you explained. In my "JSONRequest", my property starts with an upper case letter: "Step", but in my json request it is "step" with a lower case letter. Is it possible to map "step" into "Step"? Or I should create my property with a lower case start letter?
Thanks in advance
Accepted Solution
Pegasystems Inc.
IN
Hi NicolaG,
Yes, You should use same property which is present in request Json i.e 'step'.It will work.Please mark this post as helpful/correct if it helped you.
Thanks,
Abhinav
BPM Company
NL
Hi Nicola,
Is there any particular reason you want to map "step" --> "Step"?
You can use lowcase "step" in your application without any problems.
Anyway, if you really want to have "Step", then use a data layer on top of your integration. For example, you could create a data page wher in a response data transform you would set "Step" value (Data class) from "step" (Integration class)
Reply S.P.A.
IT
Hi Vaspoz,
the only reason is that I know that Pega naming convention is with the upper case letter. I hoped with "pzExternalName" I resolved this problem easily. If not I will name my property "step".
Thanks
BPM Company
NL
Basically, that's true. Whenever possible, we must use camel case.
But it's a bit different for an integration - here's a convension is an interface specification. But later you could translate it to your application layer through data layer (as I described above) and use camel case again