Code Monkey home page Code Monkey logo

sierracsharprestclient's Introduction

SierraCSharpRestClient

A strongly typed interface for Innovative's Sierra RESTful interface in C# for .Net.

The Sierra REST API provides access to the Sierra library platform database. It is intended for the use of Innovative customers and their authorized third-party associates, as well as Innovative’s commercial partners.

The Sierra REST API is a Representational State Transfer (REST) API service that provides JSON or XML responses and employs predictable, resource-oriented URLs. The system returns HTTP response codes to indicate errors. Swagger is here:

https://sandbox.iii.com/iii/sierra-api/swagger/index.html

This version deals explicitly with the PATRON branch, however, the base Sierra Client Interface will accept any branch you build for it.

Our requirement at the University of London was for a strongly typed interface, so I use some mapping.

Dependencies

NewtonSoft 11.0.1 RestSharp 106.2.1

Using the Client

If you can initiate an instance of the class by calling one of two contructors:

If you do have the bearer token (remember this is only valid for 1 hour):

_patron = new PatronApi(new SierraRestClient(BaseUrl, Token));

If you don't have the bearer token - this will always get a fresh token but it does mean you have two requests for every call:

_patron = new PatronsApi(new SierraRestClient(baseUrl, clientKey, clientSecret)));

    public SierraRestClient(string baseUrl, string accessToken)
    {
        _baseUrl = baseUrl;
        _accessToken = accessToken;

    }

    public SierraRestClient(string baseUrl, string clientKey, string clientSecret)
    {
        _baseUrl = baseUrl;
        _clientKey = clientKey;
        _clientSecret = clientSecret;
        _accessToken = AccessToken;
  }

Patron Endpoint

Once you have created an instance of IPatron interface using the following:

_patron = new PatronsApi(new SierraRestClient(baseUrl, clientKey, clientSecret)));

You can call something like:

	var patron = new StronglyTypedPatronApi(new SierraRestClient(BaseUrl, ClientKey, ClientSecret));

	var x = _patron.Get({Id});

	Assert.AreEqual(x.barcodes.FirstOrDefault(),"{barcode}");

sierracsharprestclient's People

Contributors

eudaemonic avatar stevenbaker76 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.