Giter Club home page Giter Club logo

finn-api-client's Introduction

Finn API Client

FINN.no is Norway's biggest online marketplace. They have an API, which you can read more about at finn.no/api. This client provides a wrapper around that API and returns easy to use classes for reading their data. You will need an API key, and also an organization ID to access specific data tied to said organizations.

I wrote the wrapper to access job ads from their system, but it should be able to access the rest of the resources under the ResourceType enum as well.

Create an Instance of the API Client

const string apiKey = "your-api-key";
const string orgId = "your-finn-org-id";

var api = new FinnApiClient(apiKey, orgId);

Or without the orgId:

const string apiKey = "your-api-key";

var api = new FinnApiClient(apiKey);

Get All Entries of a Type

var entries = await api.GetEntriesAsync(ResourceType.JobFullTime);

This will give you a list of all entries from the type job-full-time.

The API supports a bunch of parameters for filtering, which I didn't need for my purposed, but I included a dictionary for that. That goes in as the second parameter, while the third is a cancellation token if you want to provide that. Both the filter and cancellation token are optional.

Example

var filter = new Dictionary<string, string>
{
    {"location", "0.5"}
};

var entries = await api.GetEntriesAsync(
    ResourceType.JobFullTime,
    filter,
    myCancellationToken);

If you want to access multiple organizations with the same client, you can forgo adding in the orgId when you instanciate the API client and add it as a filter.

const string apiKey = "your-api-key";

const string orgId1 = "org-id-1";
const string orgId2 = "org-id-2";

var api = new FinnApiClient(apiKey);

var entries_org_1 = await api.GetEntriesAsync(
    ResourceType.JobFullTime,
    new()
    {
        {"orgId", orgId1}
    });

var entries_org_2 = await api.GetEntriesAsync(
    ResourceType.JobFullTime,
    new()
    {
        {"orgId", orgId2}
    });

Get a Single Finn Ad

var entry = await api.GetEntryAsync(ResourceType.JobFullTime, "single-entry-finn-id");

This function also has a third optional parameter for cancellation token.

var entry = await api.GetEntryAsync(
    ResourceType.JobFullTime,
    "single-entry-finn-id",
    myCancellationToken);

finn-api-client's People

Contributors

nagilum avatar

Watchers

 avatar  avatar

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.