![]() Which is what would be expected and is also what we see in the request body when the request is passed in as non-parameterized. When I run the request through Runner” It appears in the console as this: Working with my developer we added a statement into the Pre-request script suggested, to output the contents of the groups field from the data file to the Console: Path ‘groups’.“ĭetails:“: Could not convert string to integer: 5008,4906. Reason:"Could not convert string to integer: 5008,4906. then use the following transformation first: pizza pregreplace('\s+', ' ', pizza) So you get nice single white space. User of explode () Function This function can be used to break a string into an array of string. wenn having a namestring to split into fristname + secondname + lastname. No matter what we do with the pre-request script the data winds up as a stringīecause it is a string it is not converted to an array of integers which results in the error: In case you use this script for separating input values from a form and want to make sure there is only 1 white space between the names, e.g. We had similar problems with using a JSON Formatted Data file both before and after adding the pre-request script. The solution provided did not work for us. How do I need to “Format” the “groups” value in my csv data file, when it contains a comma separated array of “Group ID’s” so that it is properly read by Postman so that it will be properly formatted in the request body that is passed in to my API. Path ‘groups’."ĭetails:": Could not convert string to integer: 5008,5009. Reason:"Could not convert string to integer: 5008,5009. The “groups ” element in the Request Body in the Postman Console is: ![]() If I pass in “5008, 5009” (this should result in the assignment of group ID’s 5008 & 5009 being assigned to the user. In My CSV data file for a single value passed in as “5008” for the groups variable and the request is successfully processed The request is successfully processed without error and results in the assignment of group ID’s 5008 & 5009 being assigned to the user.įor the Parameterized request body for the “Groups” element I have this: The actual “Value Passed” in the Request Body, when Viewed in the Postman Console is In a Non-Parameterized request, I pass in: These are defined with the “groups” element in the request body. I’m working with an API which will create users in our applicationĪs part of this API we can assign User Access via Groups within the Application. ![]() I’m trying to understand how to pass a comma separated array of integers in to an API, via a csv data file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |