Forum Discussion

tpoirier's avatar
tpoirier
Contributor
12 years ago

Setting up a POST request

Hi, I am trying to test a REST API using the TestComplete 9. I have looked at the example on downloading a site and built the following simple test. My question come as I try to pass in the login deta...
  • dganov's avatar
    12 years ago
    I think the simplest way is to create json string yourself. It should look like this:

    var post_data_str = "{\"SerialNumber\":\"1234\",\"Login\":\"test\",\"Password\":\"111111111\"}"

    I used the Firefox Web Console to get this string from your object using JSON.stringify call.



    If you need to post many different json requests then you can get stringify code here: https://github.com/douglascrockford/JSON-js/blob/master/json2.js