Trendyol-Unofficial-API

Trendyol Unofficial API

Available Languages: 🇺🇸 🇹🇷

In the realm of e-commerce, Trendyol stands as one of the prominent platforms, offering a diverse range of products.

For developers looking to integrate Trendyol’s functionalities into their applications, crafting a robust library can streamline the process.

In this article, we’ll delve into the creation of a Node.js library tailored specifically for Trendyol, allowing seamless integration for tasks like login, store tracking, untracking stores, liking products, and undoing likes.

Introduction to Trendyol Library

Node.js, being a versatile runtime environment, empowers developers to build scalable and efficient web applications.

By leveraging JavaScript, developers can harness the power of asynchronous programming, making it an ideal choice for handling network requests and API integrations.

Our Trendyol API aims to encapsulate the intricacies of interacting with Trendyol, offering a simplified interface for developers to perform various actions seamlessly.

Getting Started

To kickstart the development process, ensure you have Node.js installed on your system. You can download it from the official Node.js website or use a package manager like npm (Node Package Manager) to install it.

Installation

$ npm i trendyol-unofficial-api
$ bun i trendyol-unofficial-api
$ pnpm i trendyol-unofficial-api

How to import

const { Trendyol } = require('trendyol-unofficial-api');

Login with Trendyol

 async function loginTrendyol() {
    const trendyol = new Trendyol();
    trendyol.username = '[email protected]';
    trendyol.password = 'your_password';
    await trendyol.login().then((result) => {
        console.log(result)
        /*
                {
                accessToken: 'eyJlbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdGFuZGFyZFVzZXIiOiIwIiwiqW5pcXVlX25hbWUiOiJjeWVzaWxgcnQ5NkBvdXRsb29rLmNvbSIsInN1YiI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwicm9sZSI6InVzZXIiLCJhdHdydG1rIjoiMjQwZDJlOWEtZWI4MS0xMWVlLThlN2ItMjJlN2YyNzc5Mzc4IiwidXNlcklkIjoiMjg5MjU3MzUiLCJlbWFpbCI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwiYXBwTmFtZSI6InR5IiwiYXVkIjoic2JBeXpZdFgraqhlTDRpZlZXeTV0eU1PTFBKV0Jya2EiLCJleHAiOjE4NjkyNTMwMzgsImlzcyI6ImF1dGgudHJlbmR5b2wuY29tIiwibmJmIjbxNzExNDY1MDM4fQ.CA5vHzWaBRSNiWKnjkV0BA4a7mBeaw-7ICaj86zR63U',
                expiresIn: 157788000,
                refreshToken: 'eyJhbGcqOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAeOjE3MTE1NTE0MzgsInN1YiI6MX0.pZ5U-LpU2IHrKT_yzidrIvbQMO_nhF0Y8tSWAcSQ0P8'
                }
        */
    }).catch((err) => {
        console.log(err)
        /*
               Please check your mail or password!
        */
    });
}
loginTrendyol();

Follow Store

async function followStore() {
    const trendyol = new Trendyol();
    const link = await trendyol.extractId('https://www.trendyol.com/magaza/online-parfum-m-117151?sst=0');
    trendyol.accessToken = 'eyJlbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdGFuZGFyZFVzZXIiOiIwIiwiqW5pcXVlX25hbWUiOiJjeWVzaWxgcnQ5NkBvdXRsb29rLmNvbSIsInN1YiI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwicm9sZSI6InVzZXIiLCJhdHdydG1rIjoiMjQwZDJlOWEtZWI4MS0xMWVlLThlN2ItMjJlN2YyNzc5Mzc4IiwidXNlcklkIjoiMjg5MjU3MzUiLCJlbWFpbCI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwiYXBwTmFtZSI6InR5IiwiYXVkIjoic2JBeXpZdFgraqhlTDRpZlZXeTV0eU1PTFBKV0Jya2EiLCJleHAiOjE4NjkyNTMwMzgsImlzcyI6ImF1dGgudHJlbmR5b2wuY29tIiwibmJmIjbxNzExNDY1MDM4fQ.CA5vHzWaBRSNiWKnjkV0BA4a7mBeaw-7ICaj86zR63U'
    await trendyol.followStore(link).then((result) => {
        console.log(result);
        /*
        {
            "couponStatus": false,
            "couponStatusMessages": [
                {
                    "key": "CollectableCouponIsAlreadyCollected",
                    "message": "Kazanılan kuponlar maalesef tekrar kazanılamıyor. Keyifli alışverişler"
                }
            ],
            "discount": "",
            "followStatus": true
        }
        */
    }).catch((err) => {
        console.log(err);
    });
}
followStore();

Unfollow Store

async function unfollowStore() {
    const trendyol = new Trendyol();
    const link = await trendyol.extractId('https://www.trendyol.com/magaza/online-parfum-m-117151?sst=0');
    trendyol.accessToken = 'eyJlbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdGFuZGFyZFVzZXIiOiIwIiwiqW5pcXVlX25hbWUiOiJjeWVzaWxgcnQ5NkBvdXRsb29rLmNvbSIsInN1YiI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwicm9sZSI6InVzZXIiLCJhdHdydG1rIjoiMjQwZDJlOWEtZWI4MS0xMWVlLThlN2ItMjJlN2YyNzc5Mzc4IiwidXNlcklkIjoiMjg5MjU3MzUiLCJlbWFpbCI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwiYXBwTmFtZSI6InR5IiwiYXVkIjoic2JBeXpZdFgraqhlTDRpZlZXeTV0eU1PTFBKV0Jya2EiLCJleHAiOjE4NjkyNTMwMzgsImlzcyI6ImF1dGgudHJlbmR5b2wuY29tIiwibmJmIjbxNzExNDY1MDM4fQ.CA5vHzWaBRSNiWKnjkV0BA4a7mBeaw-7ICaj86zR63U'
    await trendyol.unfollowStore(link).then((result) => {
        console.log(result);
        /*
        {
            "couponStatus": false,
            "followStatus": false
        }
        */
    }).catch((err) => {
        console.log(err);
    });
}
unfollowStore();

Like Product

    async function likeProduct() {
        const trendyol = new Trendyol();
        const link = await trendyol.extractId('https://www.trendyol.com/bargello/kadin-parfum-324-oriental-50-ml-edp-8691841304713-p-34117096');
        trendyol.accessToken = 'eyJlbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdGFuZGFyZFVzZXIiOiIwIiwiqW5pcXVlX25hbWUiOiJjeWVzaWxgcnQ5NkBvdXRsb29rLmNvbSIsInN1YiI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwicm9sZSI6InVzZXIiLCJhdHdydG1rIjoiMjQwZDJlOWEtZWI4MS0xMWVlLThlN2ItMjJlN2YyNzc5Mzc4IiwidXNlcklkIjoiMjg5MjU3MzUiLCJlbWFpbCI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwiYXBwTmFtZSI6InR5IiwiYXVkIjoic2JBeXpZdFgraqhlTDRpZlZXeTV0eU1PTFBKV0Jya2EiLCJleHAiOjE4NjkyNTMwMzgsImlzcyI6ImF1dGgudHJlbmR5b2wuY29tIiwibmJmIjbxNzExNDY1MDM4fQ.CA5vHzWaBRSNiWKnjkV0BA4a7mBeaw-7ICaj86zR63U';
        await trendyol.likeProduct(link).then((result) => {
            console.log(result);
            /* {
                "error": null,
                    "headers": { },
                "isSuccess": true,
                    "result": true,
                        "statusCode": 200
            } */
        }).catch((err) => {
            console.log(err);
        });
    }
    likeProduct();

Unlike Product

    async function unlikeProduct() {
        const trendyol = new Trendyol();
        const link = await trendyol.extractId('https://www.trendyol.com/bargello/kadin-parfum-324-oriental-50-ml-edp-8691841304713-p-34117096');
        trendyol.accessToken = 'eyJlbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdGFuZGFyZFVzZXIiOiIwIiwiqW5pcXVlX25hbWUiOiJjeWVzaWxgcnQ5NkBvdXRsb29rLmNvbSIsInN1YiI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwicm9sZSI6InVzZXIiLCJhdHdydG1rIjoiMjQwZDJlOWEtZWI4MS0xMWVlLThlN2ItMjJlN2YyNzc5Mzc4IiwidXNlcklkIjoiMjg5MjU3MzUiLCJlbWFpbCI6ImN5ZXNpbHlydDk2QG91dGxvb2suY29tIiwiYXBwTmFtZSI6InR5IiwiYXVkIjoic2JBeXpZdFgraqhlTDRpZlZXeTV0eU1PTFBKV0Jya2EiLCJleHAiOjE4NjkyNTMwMzgsImlzcyI6ImF1dGgudHJlbmR5b2wuY29tIiwibmJmIjbxNzExNDY1MDM4fQ.CA5vHzWaBRSNiWKnjkV0BA4a7mBeaw-7ICaj86zR63U';
        await trendyol.unlikeProduct(link).then((result) => {
            console.log(result);
            /* {
                "error": null,
                    "headers": { },
                "isSuccess": true,
                    "result": true,
                        "statusCode": 200
            } */
        }).catch((err) => {
            console.log(err);
        });
    }
    unlikeProduct();

Keywords

Trendyol, Trendyol API, Trendyol Unofficial API, trendyol api url, trendyol api entegrasyonu javascript, trendyol api entegrasyonu typescript, trendyol api entegrasyonu nodejs, trendyol go api, trendyol public api, trendyol api entegrasyonu, trendyol api ürün listeleme, trendyol api test, trendyol api javascript, trendyol api typescript, trendyol api nodejs, trendyol api github, trendyol api destek, trendyol api kullanımı, trendyol sipariş api, trendyol api bilgileri, trendyol fatura api, trendyol api döküman, trendyol api key nedir, trendyol rest api, trendyol api authentication, trendyol entegrasyon api, trendyol api postman, trendyol yemek api, trendyol api documentation, trendyol api key, trendyol pazaryeri api, trendyol api anahtarı, trendyol api entegrasyonu nasıl yapılır, trendyol api nedir, NodeJS Developer, Back-end Developer, Node.JS Developer, Backend Developer

Github Patreon BuyMeaCoffee
Copyright: [email protected]  Other Issues: [email protected]

Social Media

Linkedin Twitter Bluesky Instagram Youtube Telegram Github Npmjs

License

Can Yesilyurt cy4udev