Custom Request Payload for REST activity with JSON array

Comments

6 comments

  • Avatar
    Harish lakshmana

    Eddie,

     

    Can you make sure that the sample payload in the request mapping is having more than one item inside the JSON array?

    The Mapper needs it to be more than one to detect the repeating nature of the request.

     

    Regards,

     Harish

    0
    Comment actions Permalink
  • Avatar
    Edward Mooney

    Hi Harish, thanks for your response. In the sample payload, when I use this in my JSON array:

    "lstTypes": [
    {"CategoryType": " " },
    { "CategoryType": " " }
    ]

    The mapping only detects one item in the array.

    The choice field has the data separated by a semicolon. I can use the custom data conversion to parse out the data but I'm not sure how to map that into the array. I hope I'm explaining this ok.

    Thanks again for your help,

    Eddie

    0
    Comment actions Permalink
  • Avatar
    Harish lakshmana

    That is correct Eddie. It will only show 'CategoryType' once. Since it gets detected as repeating the runtime part is capable of producing any number of lstTypes array items.

    Note: I noticed that your have not mapped istTypes to right side data properties. that is mandatory for repeating to work.

     

    Regarding custom data conversion to convert semicolon separated data to an JSON array, I think 'SelectedTypeofTechnology' is the choice filed which are you referring to. Am I correct?

    It seems to be complex and I have not seen the possibility of doing such conversion using the OOTB features. I will let you know if I come up with something that will help you.

    Have you considered any alternatives outside of custom conversion where you have more control of the data and it's structure? 

     

    Regards,

     Harish

    0
    Comment actions Permalink
  • Avatar
    Edward Mooney

    Hi Harish, your feedback was helpful. I was able to get this to work by using a dropdown field within a repeatable subform and mapping that to the JSON array. Using a drop-down field is not the most user friendly though. Is there a way to use the checkbox field with this approach?

    I'm new to AgilePoint so I'm not familiar with other alternative that would give me more control. I would like to explore this option. I have 2 repeatable sub-forms now that I will need control how this data gets passed to the API. Is there some documentation that can help understand these alternatives?

    Thanks for your continued support here.

    Eddie

    0
    Comment actions Permalink
  • Avatar
    Harish lakshmana

    Can you share the full request JSON and response JSON structure, Eddie.

    Perhaps I can take a look at it and hopefully my knowledge is useful to find possibilities.

    0
    Comment actions Permalink
  • Avatar
    Edward Mooney

    Hi Harish, below is the request and response structure. My eForm has a repeatable subform with a nested repeatable subform to hold the types.

    Request Type:
    {
    "PtNumber": "postmanTestD_20201113",
    "IsTA": "false",
    "BusinessUnit": "IAS",
    "FunctionalArea": "IAS-PR",
    "Revision": "5",
    "UserID": "M123456",
    "lstTypes": [
         { "CategoryType": "Type 1" },
         { "CategoryType": "Type 2" },
         { "CategoryType": "Type 3" }
    ]
    }

    Response Example:
    {
    "Status": "FAILED",
    "Message": "Category type 1 : should not be empty",
    "Data": null,
    "ExceptionCode": 0
    }

     

    Thanks again for your help

    0
    Comment actions Permalink

Please sign in to leave a comment.