Software Alternatives & Reviews

Souping Up the DEV.to API with Vala

DEV.to cURL
  1. 1
    Where software engineers connect, build their resumes, and grow.
    /** * Retrieves the username corresponding to the API-Key. * Returns true if the API Key worked, false otherwise. * * @param username Receives the alias associated with the API-Key * @param api_key The API KEY to use for authentication */ Public bool get_authenticated_user ( out string username, string api_key) { // Create a WebCall to handle this session WebCall authentication = new WebCall ("https://dev.to", "/api/users/me"); // The Authentication API expects a GET request authentication.set_get (); // Add our API Key authentication.add_header ("api-key", api_key); // Perform our call bool res = authentication.perform_call (); if (!res) { return false; } // Parse the reponse Json.Parser parser = new Json.Parser (); parser.load_from_data (authentication.response_str); Json.Node data = parser.get_root (); UserResponse response = Json.gobject_deserialize ( typeof (UserResponse), data) as UserResponse; username = response.username; return true; }.

    #CMS #Blogging #Blogging Platform 384 social mentions

  2. 2
    cURL is a computer software project providing a library and command-line tool for transferring data...
    Pricing:
    • Open Source
    The DEV API is well documented. This post is more about Valavangelism (it's a great language). For API calls across the net, Vala has bindings for both cURL and libsoup2. Libsoup integrates with Vala's Main Loop and has a nice API. Libsoup + json-glib provides a fun and friendly way to interact with REST API's.

    #API Tools #APIs #Developer Tools 105 social mentions

Discuss: Souping Up the DEV.to API with Vala

Log in or Post with