Git Product home page Git Product logo

http-client-for-restful-api's Introduction

Communication with REST API.


For parsing JSON files I used "Parson", as suggested in the theme requirement, calling methods: json_parse_string (string) (creates a JSON type value from a string), json_object_get_string (json_object (obj), "numecamp") (extracts the value of the "numecamp" field from the JSON object), json_object_dotget_object (json_object (obj), "numecamp") (extracts a field / object from a JSON value).

The client (client.c) makes GET and POST requests based on the statements received at each task, in the same program running:

- get_ip method - returns the ip address of the received domain as a parameter;
- hand:
- Task 1: Make a Get request at the address / port mentioned in the request;
- Task 2: Extracts the parameters from the response received from the server (cookies, data, ..) and parses the JSON file according to the required information (username, password, ..). It will make a request of type GET / POST (as it is mentioned in the "method" field), with the necessary headers and the value of the cookies received previously to which adds the credentials extracted from the JSON file, the "data" field;
- Task 3: Will perform the steps from task 2, making sure that it adds in addition to the request, the header of "Authorization", in which it completes the value of the token received previously, extracted from the field "data" and updates the "path" to which the request is made with the answers of the guessers;
- Task 4: Will perform the steps from the previous task, making a request with the parameters mentioned in the JSON file;
- Task 5: Extracts the parameters from the response received from the server (cookies, data) and parses the JSON file according to the necessary information. It will extract the domain name whose IP address is to be found, and then do so by the "get_ip" method. A request will be made to this address, respecting the parameters in the response received from the server and adding to the "path" of the request, the parameters "q" and "APPID", with their values, previously received from the server. Resend the response from the domain to the server;

In requests.c you can find the functions that compose the HTTP message, according to the type of request: GET / POST and the required headers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.