Skip to content

Instantly share code, notes, and snippets.

@omeroot
Last active May 8, 2019 18:12
Show Gist options
  • Save omeroot/170a46690fc3cb5d56e5aeb0fd754786 to your computer and use it in GitHub Desktop.
Save omeroot/170a46690fc3cb5d56e5aeb0fd754786 to your computer and use it in GitHub Desktop.

Login

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/login/influencer',
  headers: 
   { 'Postman-Token': '74a0bdaf-2ddb-4e75-b5cc-ddf7a0136087',
     'cache-control': 'no-cache',
     'Content-Type': 'application/json' },
  body: { email: 'duyguozaslan.pr@gmail.com', password: 'duygu123' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "id": 10,
    "name": "Duygu Ozaslan",
    "email": "duyguozaslan.pr@gmail.com",
    "token": "a7537a10-5bbb-11e9-b9f3-3e9e600701f0",
    "isInfluencer": true
}

Home Page

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/inf/dashboard',
  headers: 
   { 'Postman-Token': '6e17c698-e4c4-4330-92ab-05fd49e1f08b',
     'cache-control': 'no-cache',
     affiby_token: 'a7537a10-5bbb-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: { email: 'duyguozaslan.pr@gmail.com', password: 'duygu123' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": {
        "campaigns": [
            {
                "id": 6,
                "name": "Avantajlar Pazari "
            },
            {
                "id": 1,
                "name": "Campaign 1"
            }
        ],
        "report": {
            "totalSales": 0,
            "newUser": 9049,
            "sessionCount": 9262,
            "campaign": {
                "id": 10,
                "name": "Reebok Affiby",
                "code": "Reebok Affibyefe8cccf",
                "currency": "TRY",
                "startDate": "2019-03-20T21:00:00.000Z",
                "endDate": "2019-05-20T21:00:00.000Z",
                "cookieExpire": 7,
                "medium": null,
                "term": null,
                "source": null,
                "content": "",
                "organizationId": 6,
                "atCreated": "2019-03-21T08:10:29.000Z",
                "isDeleted": 0,
                "isStarted": 0,
                "revenue": 0,
                "orderNumber": 0
            },
            "campaignCommission": [
                {
                    "campaignId": 10,
                    "lowest": 0,
                    "commissionInfluencer": 5
                },
                {
                    "campaignId": 10,
                    "lowest": 500000,
                    "commissionInfluencer": 11
                },
                {
                    "campaignId": 10,
                    "lowest": 1500000,
                    "commissionInfluencer": 11
                },
                {
                    "campaignId": 10,
                    "lowest": 3000000,
                    "commissionInfluencer": 11
                },
                {
                    "campaignId": 10,
                    "lowest": 50000,
                    "commissionInfluencer": 7
                },
                {
                    "campaignId": 10,
                    "lowest": 200000,
                    "commissionInfluencer": 9
                },
                {
                    "campaignId": 10,
                    "lowest": 500000,
                    "commissionInfluencer": 11
                },
                {
                    "campaignId": 10,
                    "lowest": 0,
                    "commissionInfluencer": 9
                }
            ],
            "totalCommissionAmount": 0,
            "cpc": 0
        },
        "locales": {
            "USD": "en",
            "TRY": "tr-TR"
        }
    }
}

Offers

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/offers',
  headers: 
   { 'Postman-Token': '1657f70f-5de2-4f07-9045-2dc8e1e106d5',
     'cache-control': 'no-cache',
     affiby_token: 'a7537a10-5bbb-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: { email: 'duyguozaslan.pr@gmail.com', password: 'duygu123' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": {
        "offerList": [
            {
                "id": 4,
                "commissionRate": null,
                "pageURL": "https://www.filtrcafe.com/",
                "status": 2,
                "currency": "TRY",
                "campaignId": 7,
                "campaignName": "Filtr Cafe Kampanya",
                "startDate": "2019-03-09T21:00:00.000Z",
                "endDate": "2019-03-31T21:00:00.000Z",
                "contractContent": "<p><br></p>",
                "contractFilepath": "contracts/1548969814047.pdf",
                "contractId": 3,
                "goal": [
                    {
                        "l": "0 ",
                        "h": " 50000 ",
                        "r": "% 2.00",
                        "currency": "TRY"
                    },
                    {
                        "l": "0 ",
                        "h": " 500000 ",
                        "r": "% 2.00",
                        "currency": "TRY"
                    }
                ]
            },
            {
                "id": 5,
                "commissionRate": 0,
                "pageURL": "https://www.reebok.com.tr",
                "status": 2,
                "currency": "TRY",
                "campaignId": 10,
                "campaignName": "Reebok Affiby",
                "startDate": "2019-03-20T21:00:00.000Z",
                "endDate": "2019-05-20T21:00:00.000Z",
                "contractContent": "<p><br></p>",
                "contractFilepath": "contracts/1548969814047.pdf",
                "contractId": 3,
                "goal": [
                    {
                        "l": "0 ",
                        "h": " 50000 ",
                        "r": "% 5.00",
                        "currency": "TRY"
                    },
                    {
                        "l": "50000 ",
                        "h": " 200000 ",
                        "r": "% 7.00",
                        "currency": "TRY"
                    },
                    {
                        "l": "200000 ",
                        "h": " 500000 ",
                        "r": "% 9.00",
                        "currency": "TRY"
                    },
                    {
                        "l": "500000 ",
                        "h": " 1000000 ",
                        "r": "% 11.00",
                        "currency": "TRY"
                    }
                ]
            }
        ],
        "locales": {
            "USD": "en",
            "TRY": "tr-TR"
        }
    }
}

Cargo Request Add

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/affiliate/cargo/request',
  headers: 
   { 'Postman-Token': 'a54f0b9a-5b62-4cc6-aacf-2edcc00e8800',
     'cache-control': 'no-cache',
     affiby_token: '26e4153a-5bbe-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: 
   { planId: '4',
     address: 3,
     products: 'http://reebok.com/ayakkabi' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": ""
}

Contract Aggree

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/affiliate/contract/aggree',
  headers: 
   { 'Postman-Token': 'e74013ae-ef4d-46ca-b10d-d505a52176ba',
     'cache-control': 'no-cache',
     affiby_token: '26e4153a-5bbe-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: { contractId: 3, campaignId: 7 },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": ""
}

Cargo List

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/affiliate/cargo',
  headers: 
   { 'Postman-Token': 'bf2a261b-3a7b-476e-80eb-5a5f3964ee36',
     'cache-control': 'no-cache',
     affiby_token: '26e4153a-5bbe-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: { contractId: 3, campaignId: 7 },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": {
        "cargoList": [
            {
                "id": 3,
                "campaignName": "Filtr Cafe Kampanya",
                "products": "http://reebok.com/ayakkabi",
                "status": 0,
                "atCreated": "2019-04-10T18:34:55.000Z",
                "city": null,
                "district": null,
                "address": null
            },
            {
                "id": 2,
                "campaignName": "Filtr Cafe Kampanya",
                "products": "http://reebok.com/ayakkabi",
                "status": 0,
                "atCreated": "2019-04-10T18:34:25.000Z",
                "city": null,
                "district": null,
                "address": null
            },
            {
                "id": 1,
                "campaignName": "Reebok Affiby",
                "products": "https://example.com/product1\r\nhttps://example2.com/product4",
                "status": 0,
                "atCreated": "2019-04-10T18:30:32.000Z",
                "city": "İstanbul",
                "district": "Sarıyer",
                "address": "Maslak Mah. Söğütözü sok. Ağaoğlu maslak 1453 sitesi A4 257 Sarıyer İstanbul"
            }
        ]
    }
}

Generate Link

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/affiliate/generate/link',
  headers: 
   { 'Postman-Token': 'd5b2a00a-138c-4a83-98de-f0eba385ccbf',
     'cache-control': 'no-cache',
     affiby_token: '26e4153a-5bbe-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: 
   { campaignId: 7,
     planId: 4,
     pageURL: 'https://www.filtrcafe.com',
     link: 'https://www.filtrcafe.com' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": false,
    "message": "Success.",
    "data": "https://affiby.direct/analytics/156b1da9670d2253a810ed05856b"
}

Profile Info

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/inf/profile/info',
  headers: 
   { 'Postman-Token': '33fc87c1-f0ff-4eec-84ea-183e6dd542db',
     'cache-control': 'no-cache',
     affiby_token: '26e4153a-5bbe-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: 
   { campaignId: 7,
     planId: 4,
     pageURL: 'https://www.filtrcafe.com',
     link: 'https://www.filtrcafe.com' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": {
        "active": "profile",
        "email": "duyguozaslan.pr@gmail.com",
        "name": "Duygu Ozaslan"
    }
}

Profile Update

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/inf/profile/update',
  headers: 
   { 'postman-token': '1cb4e989-88ad-5012-07a7-e04cb1cc3e97',
     'cache-control': 'no-cache',
     'content-type': 'application/json',
     'affiby-token': '99264ac2-4ae5-11e9-86f4-02c3ed54ef76' },
  body: { name: 'omer', email: 'dd@gmail.com', password: '223' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
}

City List

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/city-list',
  headers: 
   { 'postman-token': 'c2ee84be-4f97-30bc-cdfc-8d4cdbd31a9f',
     'cache-control': 'no-cache',
     'content-type': 'application/json' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": [
        {
            "il": "Adana",
            "plaka": 1,
            "ilceleri": [
                "Aladağ",
                "Ceyhan"
            ]
        }
    ]
}

Address List

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/inf/profile/address',
  headers: 
   { 'Postman-Token': '1310aa04-66ad-44e4-bab5-bac07680576e',
     'cache-control': 'no-cache',
     affiby_token: '26e4153a-5bbe-11e9-b9f3-3e9e600701f0',
     'Content-Type': 'application/json' },
  body: 
   { campaignId: 7,
     planId: 4,
     pageURL: 'https://www.filtrcafe.com',
     link: 'https://www.filtrcafe.com' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": {
        "active": "addresses",
        "addresses": [
            {
                "id": 1,
                "accountId": 10,
                "name": "ev",
                "city": "İstanbul",
                "district": "Sarıyer",
                "address": "Maslak Mah. Söğütözü sok. Ağaoğlu maslak 1453 sitesi A4 257 Sarıyer İstanbul",
                "isDeleted": 0
            }
        ]
    }
}

Address Add

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/inf/profile/address/add',
  headers: 
   { 'Postman-Token': '233556ab-4a91-473f-a38c-e714a65d1901',
     'cache-control': 'no-cache',
     'Content-Type': 'application/json',
     'affiby-token': '8e8ed86b-6667-11e9-86f4-02c3ed54ef76' },
  body: 
   { addressName: 'ev',
     city: 'Istanbul',
     district: 'Kadikoy',
     address: 'Evim' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});


[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
}

Address Edit

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/inf/profile/address/edit/4',
  headers: 
   { 'Postman-Token': '6f8103a6-7036-4da5-99be-7eb50ae3f006',
     'cache-control': 'no-cache',
     'Content-Type': 'application/json',
     'affiby-token': '8e8ed86b-6667-11e9-86f4-02c3ed54ef76' },
  body: 
   { addressName: 'ev',
     city: 'Istanbul',
     district: 'Kadikoy',
     address: 'Evim Evim guzel evim' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});


[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
}

Bank Add

var request = require("request");

var options = { method: 'POST',
  url: 'http://localhost:8877/inf/profile/bank/add',
  headers: 
   { 'Postman-Token': 'f2d258a3-14f9-4884-991b-8d8df98eeb58',
     'cache-control': 'no-cache',
     'Content-Type': 'application/json',
     'affiby-token': '8e8ed86b-6667-11e9-86f4-02c3ed54ef76' },
  body: { name: 'bank1', iban: '111222' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});


[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
}

Bank List

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/inf/profile/bank',
  headers: 
   { 'Postman-Token': 'a4f2a553-621a-471e-8037-610f577f38bc',
     'cache-control': 'no-cache',
     'Content-Type': 'application/json',
     'affiby-token': '8e8ed86b-6667-11e9-86f4-02c3ed54ef76' },
  body: { name: 'bank1', iban: '111222' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": {
        "active": "bank",
        "banks": [
            {
                "id": 2,
                "accountId": 9,
                "number": null,
                "name": "bank1",
                "isDeleted": 0
            },
            {
                "id": 3,
                "accountId": 9,
                "number": "111222",
                "name": "bank1",
                "isDeleted": 0
            }
        ]
    }
}

Cargo List

var request = require("request");

var options = { method: 'GET',
  url: 'http://localhost:8877/inf/profile/shipping',
  headers: 
   { 'Postman-Token': '8eb5332f-dda2-4723-8170-d3087f284e41',
     'cache-control': 'no-cache',
     'Content-Type': 'application/json',
     'affiby-token': '8e8ed86b-6667-11e9-86f4-02c3ed54ef76' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

[ RESPONSE ]
{
    "statusCode": 200,
    "error": "",
    "message": "",
    "data": {
        "active": "shipping",
        "cargoList": [
            {
                "id": 1,
                "campaignName": "Filtr Cafe Kampanya",
                "products": "https://a.com/b_product",
                "status": 0,
                "atCreated": "2019-04-24T11:49:41.000Z",
                "city": null,
                "district": null,
                "address": null
            }
        ]
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment