# Formatting a Web Service request

**URL:** <https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078>\
**Category:** 3rd Party Modules\
**Tags:** ignition80\
**Created:** [May 25, 2021, 12:07pm UTC](https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078 "2021-05-25T12:07:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahardin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahardin/32/66398_2.png) [@ahardin](https://forum.inductiveautomation.com/u/ahardin)\
**Post date:** [May 25, 2021, 12:07pm UTC](https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078/1 "2021-05-25T12:07:21Z")

</div>

I’m working with a web service request that I can’t seem format into a dataset. I’m using Sepasoft’s Web Service Module and Ignition 8.0.

Printing the results returns the following.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d5be7c88fbd438db7c7d823c8653704d2d90fd79.png)

Trying to drill down to the results, I try the following:  
print wcSetup.getChild(‘ExecuteDataSourceResponse’).getChild(‘ExecuteDataSourceResult’).getChild(‘ResultSets’).getChild(‘ResultSet’)

The results to this are below:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/f/2f0b2b23e03569a501913ec83b8f2dbd9f557c1d.png)

I’m not sure what to do next. Could anyone offer any suggestions?

Very much appreciated!

Aaron

---

<div class="post-metadata">

**Author:** ![jesse.records](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jesse.records/32/10960_2.png) [@jesse.records](https://forum.inductiveautomation.com/u/jesse.records)\
**Post date:** [May 25, 2021, 2:51pm UTC](https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078/2 "2021-05-25T14:51:24Z")

</div>

@ahardin,

Personally, I like using a python dictionary to drill down into child elements.  
This function is how you do it: [system.ws.toDict(wsresponse)](https://help.sepasoft.com/docs/display/SEPA/system.ws.toDict)

From there you can loop through your list of results and reference the fields you want to pull out.

If more help is needed, feel free to schedule a time with us here:  
[Design Consultation](https://calendly.com/mes-demos/design-consult)

---

<div class="post-metadata">

**Author:** ![ahardin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahardin/32/66398_2.png) [@ahardin](https://forum.inductiveautomation.com/u/ahardin)\
**Post date:** [May 25, 2021, 2:57pm UTC](https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078/3 "2021-05-25T14:57:56Z")

</div>

Thanks! I’ll give that a try

---

<div class="post-metadata">

**Author:** ![ahardin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahardin/32/66398_2.png) [@ahardin](https://forum.inductiveautomation.com/u/ahardin)\
**Post date:** [May 26, 2021, 3:26pm UTC](https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078/4 "2021-05-26T15:26:01Z")

</div>

It seems like this is the correct path, but I’m unable to map the Name with a dataset header and the Value to its cell. I’ve tried the following:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/d/4d6d8e7fa8ebedecf182385eb9c5902724c334b0.png)

Here are the results:  
[{u’Columns’: {u’Column’: [{u’Name’: u’Job\_No’, u’Value’: 45558}, {u’Name’: u’Part\_No’, u’Value’: u’800228-B’}, {u’Name’: u’Part\_Revision’, u’Value’: u’B’}, {u’Name’: u’Part\_Name’, u’Value’: u’GMX351 - Global Wet Side Absorber’}, {u’Name’: u’Job\_Op\_No’, u’Value’: 10}, {u’Name’: u’Job\_Op\_Color’, u’Value’: u’#D2F3CF’}, {u’Name’: u’Operation\_Code’, u’Value’: u’Die Cut / Inspect & Pack’}, {u’Name’: u’Standard\_Quantity’, u’Value’: 120}, {u’Name’: u’Standard\_Container\_Type’, u’Value’: u’’}, {u’Name’: u’Workcenter\_Status\_Color’, u’Value’: u’#03fa03’}, {u’Name’: u’Workcenter\_Status\_Description’, u’Value’: u’Production’}, {u’Name’: u’Conatiner\_Serial\_No’, u’Value’: u’’}, {u’Name’: u’Container\_Status’, u’Value’: u’’}, {u’Name’: u’Container\_Status\_Color’, u’Value’: u’’}, {u’Name’: u’Logged\_Operators’, u’Value’: u’test, user|’}, {u’Name’: u’Workcenter\_Code’, u’Value’: u’E31 Bruno 3’}, {u’Name’: u’Part\_Key’, u’Value’: 7371644}, {u’Name’: u’Part\_Operation\_Key’, u’Value’: 18048360}, {u’Name’: u’Operation\_Key’, u’Value’: 31957}, {u’Name’: u’Shift\_Group’, u’Value’: 1}, {u’Name’: u’Allow\_Production’, u’Value’: u’’}]}}]

@jesse.records could you help me with this loop? This request only has a single row but I know we will need this for much larger datasets.

I need the dataset to look like this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8ada5e17de9e74183aa98735f482cc4648fbfb85.png)

Thank you very much!

---

<div class="post-metadata">

**Author:** ![jesse.records](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jesse.records/32/10960_2.png) [@jesse.records](https://forum.inductiveautomation.com/u/jesse.records)\
**Post date:** [May 26, 2021, 8:40pm UTC](https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078/5 "2021-05-26T20:40:13Z")

</div>

@ahardin,

Ok I see what you are trying to do here.

Take a look at this video: [6.6.3: Scripting in Web Services: Parsing wsVariables | Sepasoft MES Solutions](https://www.sepasoft.com/video-library/6-6-3-scripting-in-web-services-parsing-wsvariables/)

You might revert back to your method of using getChild() then call toDataset() on the child (wsVariable) you wish to parse to an Ignition dataset: [system.ws.toDataset - MES Platform 3.0 - Sepasoft MES Help Documentation](https://help.sepasoft.com/docs/display/SEPA/system.ws.toDataset)

Otherwise, you can loop over the key:value pair as a dictionary and build one yourself if you needed to build a subset of the data returned.

Thanks,

Jesse

---

<div class="post-metadata">

**Author:** ![ahardin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahardin/32/66398_2.png) [@ahardin](https://forum.inductiveautomation.com/u/ahardin)\
**Post date:** [May 26, 2021, 11:30pm UTC](https://forum.inductiveautomation.com/t/formatting-a-web-service-request/47078/6 "2021-05-26T23:30:44Z")

</div>

Thank you! I’ll try this tonight.
