Giter VIP home page Giter VIP logo

lidlapi's Introduction

Lidl Plus API in .NET 5

licence badge issues badge prwelcome badge .NET 5 CI

API in .NET 5 using C# which can be used to read data from the Lidl Plus API used by the Lidl Plus app. Includes Unit Tests and a sample ConsoleApp to test the API. All assemblies are signed and compiled against .NET 5 which makes it usable cross platform and across all .NET supporting languages.

Notice

Note that in no way this code is supported by Lidl itself. Lidl has now implemented a system which prevents logging in to their APIs by third parties. This code therefore no longer works and there is no (easy) way to get it to work again. Use it for inspiration, but don't expect it to work anymore as-is. I personally have no intent to fix it again.

Usage

If you want to build the code locally, copy the App.sample.config file under ConsoleApp and UnitTest to App.config and fill it with your Lidl Plus e-mail address and password.

You can create a new session to connect to the Lidl Plus services using:

// Create a new Session instance to connect with the Lidl APi
var session = new KoenZomers.Lidl.Api.Session();

This will connect it to the Lidl Plus services of The Netherlands and return content in Dutch. If you wish to connect to Lidl Plus for another county and/or language, you can pass this in through one of the optional arguments in the constructor, i.e. for Germany use:

// Create a new Session instance to connect with the Lidl APi
var session = new KoenZomers.Lidl.Api.Session(language: "DE-DE", country: "DE");

The other optional parameters in the constructor you typically should not change from their defaults.

Once you have the session initiated, you need to authenticate it first using:

// Authenticate to the Lidl Plus API using an e-mail address and password
await session.Authenticate("[email protected]", "myLidlPlusPassword");

Instead of using the e-mail address and password to authenticate, you can also use a refresh token to do so, which is a faster way to authenticate as it requires fewer steps behind the scenes:

// Authenticate to the Lidl Plus API using a refresh token
await session.Authenticate("refreshToken");

Once authenticated, you can call one of the methods to retrieve data from the Lidl Plus services, such as:

// Retrieve all your receipts
await session.GetReceipts();

// Retrieve all your coupons
await session.GetCoupons();

// Retrieve all the scratch coupons you receive after a purchase for discounts on items
await session.GetScratchCoupons();

// Scratch open the coupon with the provided id
await session.RedeemScratchCoupon("couponid");

// Mark a specific receipt as favorite
await session.MakeReceiptFavorite("receiptid");

Have a look at the Unit Tests and/or Console Application for seeing additional samples about the available data you can pull from the API.

NuGet

Also available as NuGet Package: KoenZomers.Lidl.Api

Version History

Version 1.0.0.1 - June 7, 2021

  • Minor cosmetical fixes

Version 1.0 - June 4, 2021

  • Initial version

Feedback

Comments\suggestions\bug reports are welcome!

Koen Zomers [email protected]

lidlapi's People

Contributors

koenzomers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lidlapi's Issues

[BUG] System.Text.Json.JsonException

Describe the bug
If I try to authenticate with email and password, I get an error:
JsonReaderException: 'B' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.

I cloned a repo and debugged the code locally. I found an issue:

session.Authenticate -> DoesEmailExist -> pageContent variable get back a special string, and the next line get an error when it try to deserialize this string.

I have a normal email address which is registered to the lidl app, I use this app for 10 months.

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.