title: Getting different result on OKHTTP from postman
body: <p>I am trying to get some data from server. the main problem is I don't have the server access, but of course I know the request details, I am using PostMan for the testing server calls and than implementing them on android using OkHttp.</p>
  
  <p>Here is what I get from server on android side using both HttpUrlConnection or OkHttp : </p>
  
  <blockquote>
    <p>{"collection":{"version":"1.0","href":"<a href="http://development.abc.com:80/" rel="nofollow noreferrer">http://development.abc.com:80/</a>","links":[{"href":"#","rel":"header","prompt":"Students"},{"href":"#","rel":"header","prompt":"CFAs"},{"href":"signup","rel":"header
    trial","prompt":"Free Trial"},{"href":"about","rel":"footer
    sidebar","prompt":"About"},{"href":"testimonials","rel":"footer
    sidebar","prompt":"Testimonials"},{"href":"contact","rel":"footer","prompt":"Contact"},{"href":"faq","rel":"footer
    sidebar","prompt":"FAQs"},{"href":"login","rel":"login","prompt":"Login"}],.......</p>
  </blockquote>
  
  <p>I am using the same headers on both sides i.e</p>
  
  <pre><code>("accept", "application/vnd.collection+json")
  ("authorization", "Basic secret==")
  </code></pre>
  
  <p>and using the same credentials for test login:</p>
  
  <p>Strangely, same server call is giving below data in PostMan</p>
  
  <blockquote>
    <p>{ "collection": { "version": "1.0", "href":
    "<a href="http://development.abc.com:80/ch/re/videos" rel="nofollow noreferrer">http://development.abc.com:80/ch/re/videos</a>",
    "links": [ { "href":
    "<a href="http://development.abc.com:80/ch/re/vr" rel="nofollow noreferrer">http://development.abc.com:80/ch/re/vr</a>",
    "rel": "menu vrated", "prompt": "V rated" }, { "href":
    "<a href="http://development.abc.com:80/user/watcr" rel="nofollow noreferrer">http://development.abc.com:80/user/watcr</a>", "rel": "menu
    watchlater", "prompt": "Watch later" }...</p>
  </blockquote>
  
  <p>Here is my code: </p>
  
  <pre><code>CookieManager cookieManager = new CookieManager();
              cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
  
              OkHttpClient client =new OkHttpClient.Builder()
                      .cookieJar(new CookieJar() {
  
  
                          @Override
                          public void saveFromResponse(HttpUrl url, List&lt;Cookie&gt; cookies) {
                              cookieStore.put(url, cookies);
                              cookie=cookies.get(0).toString();
  
  
                          }
  
                          @Override
                          public List&lt;Cookie&gt; loadForRequest(HttpUrl url) {
                              List&lt;Cookie&gt; cookies = cookieStore.get(url);
                              return cookies != null ? cookies : new ArrayList&lt;Cookie&gt;();
                          }
                      })
                      .build();
  
  
              Request request = new Request.Builder()
                      .url("http://development.abc.com/login")
                      .post(body)
                      .addHeader("accept", "application/vnd.collection+json")
                      .addHeader("authorization", "Basic secret==")
                      .addHeader("cache-control", "no-cache")
                      .addHeader("Cookie",cookie)
                      .addHeader("content-type", "application/x-www-form-urlencoded")
                      .build();
  
  
  
              Response response = null;
              try
              {
  
                 response=client.newCall(request).execute();
                  String str=response.body().string();
  
              } catch (Exception e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>How can the same server call returning different results. </p>
  
  <p>I checked from " <a href="https://stackoverflow.com/questions/27060365/results-from-curl-is-different-than-results-from-postman">results from Curl is different than results from Postman</a> " that one should also need to add <code>user agent</code> in header so I also tried this one but no luck.</p>
  
  <p>One more thing that If I use the wrong credentials (i.e. body: email,password) for this call I get same error on both Okhttp and PostMan.</p>
  
  <p>Thanks.</p>