I’m trying to create account in an application with entitlement request. The request is initially going to “Create Account” Operation which is executing successfully and giving unique id in response which need to be passed in the body of “Add Entitlement” Operation.
Error code 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).
Have you tried to add entitlement using postman with this body, if so can you please share request and response for the same?
I guess you will not get responses returned from Create Operation Type in Add Entitlement Type. You could look at the below options.
If you have a single endpoint which can create account and add entitlement. Use that endpoint. Fo using that you will have add the below attriute to true in application xml.
The other option you can look at is configure an additional Endpoint for Add Entitlement. The first Endpoint will get the User Id and pass that vaue to the next Endpoint to add it to the group.
For Example: For an account Creation the following will happen.
Create Account Endpoint - Account Created
Add Entitlement Endpoint - Get User Id
Add Entitlement Endpoint - Add User to group
This option is useful for other scenarios where an existing user is raising request for entitlements.
When going with this approach you have make sure you do the response mapping for the first Add Entitlement Endpoint , something like below.
Only then you will be able to use it by using $response.id$. You can verify the body , response etc in the before rule for the second endpoint. The oldResponseMap will contain earlier response object and requestEndPoint will contain the information like header, body etc
In this case the Root Path value should be $.RequestedObject . Try using this in root path. And also try to find what is being received in the second endpoint. You can use sysout statement to print oldResponseMap in the before rule for the second endpoint.
Not sure why I modified the root path and posted. I was using the same root path which I used for my get all users $.[*].RequestedObject earlier and now I have updated to $.RequestedObject which should be the case and it is working now.
I can see oldResponseMap in the log and $.response.Id$ is also getting replaced with expected value.
Final solution for my issue is enabling below entry key and creating multiple create account operations.
Good to know that the issue is resolved. Please mark the response which helped you as solution and close this thread. This will help others looking for solution.