Hi All, I want to use Fiddler to read a response body and modify a URL with some of the information

2,180 views
Skip to first unread message

William Ferrarini

unread,
Aug 2, 2013, 4:16:27 PM8/2/13
to httpf...@googlegroups.com

Hi Everyone;

Not sure if I can do this with Fiddle but any help would be greatly appreciated.

I have a Web Service that adds records to a SQL Database.

The Records have s PSRID generated automatically by the insertion into the table so we don't know the ID of the record we create unless we bring it back in. 

so we do a Post to Create the Record and perform a Get to that URL which returns all of our records in the table in a Json formated response body.

What we would like to do is parse this file and find the PSRID, then append it to the url so that we can Modify and Delete the records for our testing.

1. Is this possible
2. If it is please if you can point me in the right direction I would appreciate it.

Thank you everyone!

Bill

EricLaw

unread,
Aug 2, 2013, 6:26:45 PM8/2/13
to httpf...@googlegroups.com
Fiddler can view, modify, parse, and generate HTTP requests and responses, so, yes, you can do all of the things you describe.
 
Unfortunately, without the specific details of the data formats, URLs, etc, it's not really likely that anyone can write the code for you. http://fiddler2.com/documentation/Extend-Fiddler/AddRules

William Ferrarini

unread,
Aug 5, 2013, 8:35:16 AM8/5/13
to httpf...@googlegroups.com
Hi Eric;

We first do a Post to write a record to the database.
--e0d4eb72-04dc-461b-8611-e6cabade8507
Content-Type: application/http; msgtype=request

POST /UtBill/api/Codes/ServiceCode HTTP/1.1
Host: os-main-app.lkm.sungardps.lcl:8080
Content-Type: application/json; charset=utf-8

{
  "ServiceType": 0,
  "AllowDeposit": false,
  "RefundEligible": false,
  "RequireJurisdiction": false,
  "RequireServiceClass": false,
  "RequireInsideOutside": false,
  "Code": "NewCode2",
  "Description": "New Code 2",
  "DirtyState": 1,
  "Status": 1,
  "UniqueId": "C-54f3a13cf0fc440aa335301c17224df5"
}
--e0d4eb72-04dc-461b-8611-e6cabade8507--

We then do a get with the same URL  /UtBill/api/Codes/ServiceCode

What we receive back is a Json response listing all the records in the database, there is no provision to ask for a particular record.

What we do manually is search the response for the PSRID for the record we just added: We will get a response like this:

{"ServiceType":2,"AllowDeposit":false,"RefundEligible":false,"RequireJurisdiction":false,"RequireServiceClass":false,"RequireInsideOutside":false,"ProrationCodePSRid":null,"ProrationCode":null,"UDFormCodePSRid":null,"UDFormCode":null,"DeliveryPointUDFormCodePSRid":null,"DeliveryPointUDFormCode":null,"JurisdictionCodes":null,"ServiceClassCodes":null,"AssetClassCodes":null,"Code":"RRF","Description":"Renewable Resource Fund","PSRid":10,"LastChangeDateTimeUTC":"2013-08-02T08:08:22.323","LastChangeUser":"LKM\\richard.rugless","LastChangeJob":"LKM\\richard.rugless","CreationDateTimeUTC":"2013-08-02T08:08:22.323","CreationUser":"LKM\\richard.rugless","CreationJob":"LKM\\richard.rugless","Status":1,"DirtyState":0,"UniqueId":"S-aeaaaa98dfb34dba8f163fde0faec251"}]

I have emphasized the PSRid which in this response 10. Remember this is the last record in the last.

What we need to do then is to execute a PUT while changing some information to modify the record and the last piece we will do is to execute a delete for this record. In order to do that we have to append the PSRID to the end of the URL.

So  /UtBill/api/Codes/ServiceCode/10

but since we don't know this PSRID before hand we would like to search the Response Body and parse this information along with a couple of other pieces of information so that we can automate this process. We have many databases and testing them all manually will take weeks!

Thanks for your help!

Bill




Reply all
Reply to author
Forward
0 new messages