Web Service Proxy with Charles

There are some scenarios where we can use Charles :

  1. Sometimes we need to change web service request parameters to check some scenarios in our App, For this we need to change these parameters in our App before sending request. So everytime we need to make changes in our App to test with different request params.
  2.  After request we get some response from server, but what if we want to make changes in response.
  3.  If we want to track request and response structures.

For all above scenarios we need web service tracking tool. There are many tools available, but we will discuss here abut Charles.

How it works!

After installing Charles on your machine, when you start it, it will not track any request – response by default. You need to enable proxy for your machine.

For Mac machine

Proxy -> Mac OS X Proxy

Now you will be able to see all request and response through your machine, But what if you want to track only few APIs, Then Filter comes in mind.

This is the most important feature in Charles, because most of the time we need to track only few APIs.

To use Filters : Proxy -> Breakpoints Settings

Now click on Add Button

After filling this form click on OK button, Port and Query field may be blank.

Note : Don’t forget to select request / response checkboxes to set breakpoints.

Now you all setup, only thing to enable breakpoints. For this you need to select

Proxy -> Start Recording

Now Charles will give you the option to change request before web service hit and after getting response from server, so you can change the response according to your need before providing it to your App.

Happy Reading!!!

Leave a Reply