API - Ticket advertisment REST

REST API to add/edit advertisment

Every modification will modify the related database tables.

Every REST call needs a login

Creating an advertisment (advertismentService.java)

POST /qnet6/rest/advertisment/advert

Java: saveNewAdvert

Creating a new ad

Request:

{
    "advName": "test01",
    "advText1": "Ad text",
   "advPriority": "0",
    "advStart": 20180604,
    "advEnd": 20190101,
    "langs": [
        {
            "adlLang": 1,
            "adlText1": "This is advert's text"
        },
        {
            "adlLang": 17,
            "adlText1": "Ez a reklám szövege"
        }
    ],
    "tasks": {
        "1": [1,2,3], // branchID is the key
        "central": [4,5,6] // no branchID
    }
}

Response OK: 200

{
    "result": "OK"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Updating an advertisment (advertismentService.java)

PUT /qnet6/rest/advertisment/advert/{advID}

Java: updateAdvert

Update an existing ad

Request

{
    "advName": "test01",
    "advText1": "Ad text",
    "advPriority": "0",
    "advStart": 20180604,
    "advEnd": 20190101,
    "langs": [
        {
            "adlLang": 1,
            "adlText1": "This is advert's text"
        },
        {
            "adlLang": 17,
            "adlText1": "Ez a reklám szövege"
        }
    ],

    "tasks": {
        "1": [1,2,3], // branchID is the key
        "central": [4,5,6] // no branchID
    }
}

Response OK: 200

{
    "result": "OK"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Deleting an advertisment (advertismentService.java)

DELETE /qnet6/rest/advertisment/advert/{advID}

Java: deleteAdvert

Response ˛OK: 200

{
    "result": "OK"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Get advertisment list (advertismentService.java)

GET /qnet6/rest/advertisment/advert/{taskID}/{langID}/{branchID}

Java: getAdvertList

Response ˛OK: 200

{
    "result": "OK",
    "response": [
        {
            "advId": 1,
            "advName": "teszt01",
            "advPriority": 1,
            "advStart": 20180604,
            "advEnd": null,
            "advText1": "Ez a reklám szövege",
            "advText2": null,
            "tasks": {
                "1" :[1,2,3],       // // branchID is the key
                "central" : [4,5,6]  // no branchID
            },

            "langs": [
                {
                    "lngId": 1,
                    "lngCode": "en-gb",
                    "adlText1": "test01",
                    "adlText2": null
                },
                {
                    "lngId": 17,
                    "lngCode": "hu",
                    "adlText1": "magyar teszt01",
                    "adlText2": null
                }
            ]
        }
    ]
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Creating a new advertisment group (advertismentService.java)

POST /qnet6/rest/advertisment/advertGroup

Java: saveNewAdvertGroup

Request

{
    "adgName": "adgTeszt01",
    "adverts": [1,3,4],
    "tasks": {
        "1": [1,2,3], // branchID is the key
        "central": [4,5,6] // no branchID
    }
}

Response ˛OK: 200

{
    "result": "OK"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Updating an advertisment group (advertismentService.java)

PUT /qnet6/rest/advertisment/advertGroup/{adgID}

Java: updateAdvertGroup

Request

{
    "adgName": "adgTeszt01",
    "adverts": [1, 2, 3, 4],
    "tasks": {
        "1": [1,2,3], // branchID is the key
        "central": [4,5,6] // no branchID
    }
}

Response OK: 200

{
    "result": "OK"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Deleting an advertisment group (advertismentService.java)

DELETE /qnet6/rest/advertisment/advertGroup/{adgID}

Java: deleteAdvertGroup

Response OK: 200

{
    "result": "OK"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Get advertisment groups (advertismentService.java)

GET /qnet6/rest/advertisment/advertGroup

Java: getAdvertGroupList

Response ˛OK: 200

{
    "result": "OK",
    "response": [
        {
            "adgId": 1,
            "adgName": "adgTeszt01",
"adverts": [1,3,4],
            "tasks": {
                "1": [1,2,3], // branchID is the key
                "central": [4,5,6] // no branchID
            }
        },
        {
            "adgId": 2,
            "adgName": "adgTeszt02",
"adverts": [1,3,4],
            "tasks": {
                "1": [1,2,3], // branchID is the key
                "central": [4,5,6] // no branchID
            }
        }
    ]
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Get the advertisment from a selected group(advertismentService.java)

GET /qnet6/rest/advertisment/advertsInGroup/{adgID}

Java: getAdvertsInGroupList

adgID: advertisment group ID

Response OK: 200

{
    "result": "OK",
    "response": [
        {
            "advId": 1,
            "advName": "teszt01",
            "advPriority": 1,
            "advStart": 20180604,
            "advEnd": null,
            "advText1": "Ez a reklám szövege",
            "advText2": null,
            "tasks": {
                "1" :[1,2,3],       // branchID is the key
                "central": [4,5,6]  // no branchID
            },
            "langs": [
                {
                    "lngId": 1,
                    "lngCode": "en-gb",
                    "adlText1": "teszt01",
                    "adlText2": null
                },
                {
                    "lngId": 17,
                    "lngCode": "hu",
                    "adlText1": "magyar teszt01",
                    "adlText2": null
                }
            ]
        }
    ]
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Get a random advertisment image in byte[]format (advertismentService.java)

GET /qnet6/rest/advertisment/getRandomAdvertImage/{langCode}/{taskArray}/{width}/{height}

Java: getRandomAdvertImage

langCode: Language code / null
taskArray: Task ID’s, separated by comma / null.
width: Image width / null.
height: Image height / null.

Response OK: 200

{
    "result": "OK",
    "response": [
        byte array
    ]
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Get a random advertisment in String format, by the entered parameters (advertismentService.java)

GET /qnet6/rest/advertisment/getRandomAdvertText/{langCode}/{taskArray}

Java: getRandomAdvertText

langCode: Language code / null
taskArray: Task ID’s, separated by comma / null.

Response OK: 200

{
    "result": "OK",
    "response": "Ez a reklám szövege"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}

Get a random advertisment in String format, by the entered parameters in a branch(advertismentService.java)

GET /qnet6/rest/advertisment/getRandomAdvertTextByBranch/{langCode}/{taskArray}/{branchID}

Java: getRandomAdvertTextByBranch

langCode: Language code / null.
taskArray: Task ID’s, separated by comma / null.
branchID: Branch ID / null.

Response OK: 200

{
    "result": "OK",
    "response": "Ez a reklám szövege"
}

Response ERROR: 404

{
    "result": "ERROR",
    "message": "ERROR! class java.lang.Exception: null"
}