Monday, December 5, 2016

API format -- JSON, Curl




  • API formats:
    • I am thinking API could be in the following formats: JSON, Curl .....
    • JSON:
      • json validator: http://jsonlint.com/
      • Json viewer: http://jsonviewer.stack.hu/



Monday, November 28, 2016

Testing API using "Insomnia" Rest client




  • Running API using 'Insomnia':
    • Source: 
      • https://insomnia.rest/
      • https://insomnia.rest/documentation/environment-variables/
    • Steps to run API in Insomnia:
      • Give the API body in the JSON tab
      • Add headers in Headers tab
      • Select Post from drop down and give url and click on Send.
      • You should see output in window on the right.



Insomnia Request Templating

    • Quickly create requests:
      • Specify URL, payload, headers, and authorization all in one place. Then just hit send.

Insomnia Request Basic Authentication









    • View detailed responses:
      • Get all the details on every response. View status code, body, headers, cookies, and more!




Tuesday, August 16, 2016

JSON structure-------------------------What are '{} and '[]' are in API json request format


  • JSON:
    • JSON: JavaScript Object Notation.
    • JSON is a syntax for storing and exchanging data.
    • JSON is an easier-to-use alternative to XML.
  • JSON syntax: 
    • It is derived from JavaScript object notation syntax:
    • Data is in name/value pairs
    • Data is separated by commas
    • Curly braces hold objects
    • Square brackets hold arrays (multiple objects)
      • [] -- looks like it is for bunch(multiple sets) of related items
      • {} -- looks like it is for one set of related item.
      • "" -- looks like every name and value should be in double quotes
      • Note: Looks like each set has "name" and "value" with colon seperated. Comma seperated.
    • JSON uses JavaScript syntax, but the JSON format is text only, just like XML.
    • Text can be read and used as a data format by any programming language.
    • JSON names require double quotes. JavaScript names don't.
  • JSON Example:
{"employees":[
    {"firstName":"John""lastName":"Doe"},
    {"firstName":"Anna""lastName":"Smith"},
    {"firstName":"Peter""lastName":"Jones"}
]}

  • XML Example:

<employees>
    <employee>
        <firstName>John</firstName> <lastName>Doe</lastName>
    </employee>
    <employee>
        <firstName>Anna</firstName> <lastName>Smith</lastName>
    </employee>
    <employee>
        <firstName>Peter</firstName> <lastName>Jones</lastName>
    </employee>
</employees>


  • JSON Files
    • The file type for JSON files is ".json"
    • The MIME type for JSON text is "application/json"

Monday, July 18, 2016

Testing using Firefox RESTClient



  • API testing tools:
    • API testing  could be done by using SOAP UI tool if you do not want to install it, you could also perform API testing using Firefox Addin - RESTClient.
  • RESTClient set up:
    • RESTClient needs some kind of set up.
      • Like adding headers
      • End point url
      • API request
    • Set up looks like below: