{"id":724,"date":"2020-12-22T14:46:43","date_gmt":"2020-12-22T14:46:43","guid":{"rendered":"https:\/\/wiki.pontiac.media\/?page_id=724"},"modified":"2024-04-27T01:53:04","modified_gmt":"2024-04-27T01:53:04","slug":"authentication","status":"publish","type":"docs","link":"https:\/\/wiki.pontiac.media\/?docs=api\/api-remarketing-campaign-tutorial\/authentication","title":{"rendered":"Authentication"},"content":{"rendered":"\n<p><span style=\"font-weight: 400;\">For this we will send a simple post request via curl.<\/span><\/p>\n\n\n\n<p><br><span style=\"font-weight: 400;\">curl -X POST https:\/\/api.pontiac.media\/auth -d &#8216;{&#8220;auth&#8221;:{&#8220;userName&#8221;:&#8221;user1&#8243;, &#8220;password&#8221;:&#8221;myPassword&#8221;}}&#8217;<\/span><br><strong>Response:<\/strong><\/p>\n\n\n\n<input type=\"checkbox\" id=\"toggle-json\" class=\"toggle-json-checkbox\">\n<label for=\"toggle-json\" class=\"toggle-json-label\">\n    <span class=\"toggle-text\"><\/span>\n<\/label>\n<div id=\"json-container\" class=\"json-container\">\n    <pre class=\"json-data\"><\/pre>\n<\/div>\n\n<style>\n    .toggle-json-checkbox {\n        display: none;\n    }\n\n    .toggle-json-checkbox:checked ~ .toggle-json-label .toggle-text::after {\n        content: \"Collapse\";\n    }\n\n    .toggle-json-label .toggle-text::after {\n        content: \"Expand\";\n    }\n\n    .toggle-json-label {\n        display: inline-block;\n        padding: 5px 10px;\n        background-color: #007bff;\n        color: #fff;\n        cursor: pointer;\n        border-radius: 5px;\n        user-select: none; \/* Make the label unselectable *\/\n    }\n\n    .json-container {\n        margin-top: 10px;\n    }\n\n    .json-data {\n        display: none;\n        font-family: 'Courier New', Courier, monospace;\n        background-color: #000;\n        color: #fff;\n        padding: 10px;\n        width: 750px;\n        border-radius: 5px;\n        white-space: pre-wrap; \/* Preserve line breaks *\/\n        overflow-x: auto; \/* Enable horizontal scrolling *\/\n        font-size: 16px; \/* Adjust font size *\/\n        line-height: 1.5; \/* Adjust line height *\/\n    }\n\n    .toggle-json-checkbox:checked ~ .json-container .json-data {\n        display: block;\n    }\n\n    .property {\n        color: #ffd700; \/* Yellow color for property names *\/\n    }\n\n    .string {\n        color: #00ff00; \/* Green color for string values *\/\n    }\n\n    .number {\n        color: #ff69b4; \/* Pink color for number values *\/\n    }\n\n    .boolean {\n        color: #ffa500; \/* Orange color for boolean values *\/\n    }\n\n    .null {\n        color: #808080; \/* Gray color for null values *\/\n    }\n\n    .json-data .property {\n        color: #ffd700 !important; \/* Yellow color for property names *\/\n    }\n\n    .json-data .string {\n        color: #00ff00 !important; \/* Green color for string values *\/\n    }\n\n    .json-data .number {\n        color: #ff69b4 !important; \/* Pink color for number values *\/\n    }\n\n    .json-data .boolean {\n        color: #ffa500 !important; \/* Orange color for boolean values *\/\n    }\n\n    .json-data .null {\n        color: #808080 !important; \/* Gray color for null values *\/\n    }\n<\/style>\n\n<script>\n    function displayJson(jsonData) {\n        var jsonContainer = document.querySelector('.json-data');\n        var jsonString = JSON.stringify(jsonData, null, 2);\n        jsonString = jsonString.replace(\/&\/g, '&amp;').replace(\/<\/g, '&lt;').replace(\/>\/g, '&gt;');\n        jsonString = jsonString.replace(\/(\"(\\\\u[a-zA-Z0-9]{4}|\\\\[^u]|[^\\\\\"])*\"(\\s*:)?|\\b(true|false|null)\\b|-?\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\/g, function (match) {\n            var cls = 'number';\n            if (\/^\"\/.test(match)) {\n                if (\/:$\/.test(match)) {\n                    cls = 'property';\n                } else {\n                    cls = 'string';\n                }\n            } else if (\/true|false\/.test(match)) {\n                cls = 'boolean';\n            } else if (\/null\/.test(match)) {\n                cls = 'null';\n            }\n            return '<span class=\"' + cls + '\">' + match + '<\/span>';\n        });\n        jsonContainer.innerHTML = jsonString;\n    }\n\n    document.addEventListener('DOMContentLoaded', function () {\n        var checkbox = document.getElementById('toggle-json');\n        checkbox.addEventListener('change', function (event) {\n            var jsonData = {\n    \"timestamp\": \"2024-04-26 16:46:46\",\n    \"response\": {\n        \"userId\": 1352,\n        \"seatId\": 555,\n        \"authToken\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ...........\",\n        \"expiration\": \"2024-04-27T00:47:13\",\n        \"userName\": \"user1\",\n        \"revType\": \"costPlus\",\n        \"seatLoginCount\": 26,\n        \"userLoginCount\": 8,\n        \"funded\": 1,\n        \"isAdmin\": 0,\n        \"appVersion\": \"1.14.0.110762ea\",\n        \"passwordChanged\": 1,\n        \"userRole\": \"user\",\n        \"dmpAccess\": 1,\n        \"hawkingApiType\": \"dsp\"\n    }\n}\n;\n\n            displayJson(jsonData);\n        });\n\n        \/\/ Initial display\n        var initialData = {\n            \"name\": \"Initial Data\",\n            \"value\": 42\n        };\n        displayJson(initialData);\n    });\n<\/script>\n\n\n\n<p><br><span style=\"font-weight: 400;\">&nbsp;<\/span><br><span style=\"font-weight: 400;\">The token received in the field authToken is to be passed in on all subsequent requests as a header called \u201cauth\u201d.<\/span><br>&nbsp;<br><b>For example, the following is a get request for an existing advertiser:<\/b><br><span style=\"font-weight: 400;\">curl -X GET -H &#8216;auth: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZWF0SWQiOjI3MDIsInVzZXJJZCI6MzU1LCJleHBpcmVzIjoiMjAyMC0wOC0SDsawMjo1NToyNyJ9.d6gUDLA_Yx_Em5REoathACFMPcfv1TgL8B87P19q7yA&#8217;&nbsp; &#8216;https:\/\/api.pontiac.media\/pontiac\/advertiser?advertiser-id=1234&#8217;<\/span><br><span style=\"font-weight: 400;\">&nbsp;<\/span><br><b>Response:<\/b><br>&nbsp;<\/p>\n\n\n\n<input type=\"checkbox\" id=\"toggle-json2\" class=\"toggle-json-checkbox2\">\n<label for=\"toggle-json2\" class=\"toggle-json-label2\">\n    <span class=\"toggle-text2\"><\/span>\n<\/label>\n<div id=\"json-container2\" class=\"json-container2\">\n    <pre class=\"json-data2\"><\/pre>\n<\/div>\n\n<style>\n    .toggle-json-checkbox2 {\n        display: none;\n    }\n\n    .toggle-json-checkbox2:checked ~ .toggle-json-label2 .toggle-text2::after {\n        content: \"Collapse\";\n    }\n\n    .toggle-json-label2 .toggle-text2::after {\n        content: \"Expand\";\n    }\n\n    .toggle-json-label2 {\n        display: inline-block;\n        padding: 5px 10px;\n        background-color: #007bff;\n        color: #fff;\n        cursor: pointer;\n        border-radius: 5px;\n        user-select: none; \/* Make the label unselectable *\/\n    }\n\n    .json-container2 {\n        margin-top: 10px;\n    }\n\n    .json-data2 {\n        display: none;\n        font-family: 'Courier New', Courier, monospace;\n        background-color: #000;\n        color: #fff;\n        padding: 10px;\n        width: 750px;\n        border-radius: 5px;\n        white-space: pre-wrap; \/* Preserve line breaks *\/\n        overflow-x: auto; \/* Enable horizontal scrolling *\/\n        font-size: 16px; \/* Adjust font size *\/\n        line-height: 1.5; \/* Adjust line height *\/\n    }\n\n    .toggle-json-checkbox2:checked ~ .json-container2 .json-data2 {\n        display: block;\n    }\n\n    .property {\n        color: #ffd700; \/* Yellow color for property names *\/\n    }\n\n    .string {\n        color: #00ff00; \/* Green color for string values *\/\n    }\n\n    .number {\n        color: #ff69b4; \/* Pink color for number values *\/\n    }\n\n    .boolean {\n        color: #ffa500; \/* Orange color for boolean values *\/\n    }\n\n    .null {\n        color: #808080; \/* Gray color for null values *\/\n    }\n\n    .json-data2 .property {\n        color: #ffd700 !important; \/* Yellow color for property names *\/\n    }\n\n    .json-data2 .string {\n        color: #00ff00 !important; \/* Green color for string values *\/\n    }\n\n    .json-data2 .number {\n        color: #ff69b4 !important; \/* Pink color for number values *\/\n    }\n\n    .json-data2 .boolean {\n        color: #ffa500 !important; \/* Orange color for boolean values *\/\n    }\n\n    .json-data2 .null {\n        color: #808080 !important; \/* Gray color for null values *\/\n    }\n<\/style>\n\n<script>\n    function displayJson2(jsonData2) {\n        var jsonContainer2 = document.querySelector('.json-data2');\n        var jsonString = JSON.stringify(jsonData2, null, 2);\n        jsonString = jsonString.replace(\/&\/g, '&amp;').replace(\/<\/g, '&lt;').replace(\/>\/g, '&gt;');\n        jsonString = jsonString.replace(\/(\"(\\\\u[a-zA-Z0-9]{4}|\\\\[^u]|[^\\\\\"])*\"(\\s*:)?|\\b(true|false|null)\\b|-?\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\/g, function (match) {\n            var cls = 'number';\n            if (\/^\"\/.test(match)) {\n                if (\/:$\/.test(match)) {\n                    cls = 'property';\n                } else {\n                    cls = 'string';\n                }\n            } else if (\/true|false\/.test(match)) {\n                cls = 'boolean';\n            } else if (\/null\/.test(match)) {\n                cls = 'null';\n            }\n            return '<span class=\"' + cls + '\">' + match + '<\/span>';\n        });\n        jsonContainer2.innerHTML = jsonString;\n    }\n\n    document.addEventListener('DOMContentLoaded', function () {\n        var checkbox = document.getElementById('toggle-json2');\n        checkbox.addEventListener('change', function (event) {\n            \n            var jsonData2 = {\n    \"timestamp\": \"2024-04-27 00:16:44\",\n    \"response\": {\n        \"Advertisers\": [\n            {\n                \"pontiacAdvertiserId\": 6992,\n                \"name\": \"myFirst Advertiser\",\n                \"status\": 1,\n                \"gdprEnabled\": 0,\n                \"gamblingEnabled\": 0,\n                \"insertionOrdersEnabled\": 1,\n                \"seatId\": 555,\n                \"hasProfile\": 1\n            }\n        ]\n    },\n    \"accountStatus\": 1,\n    \"seatId\": 555\n};\n\n            displayJson2(jsonData2);\n        });\n\n        \/\/ Initial display\n        var initialData2 = {\n            \"name\": \"Initial Data\",\n            \"value\": 42\n        };\n        displayJson2(initialData2);\n    });\n<\/script>\n","protected":false},"author":1,"featured_media":0,"parent":714,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-724","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/docs\/724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=724"}],"version-history":[{"count":54,"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/docs\/724\/revisions"}],"predecessor-version":[{"id":9330,"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/docs\/724\/revisions\/9330"}],"up":[{"embeddable":true,"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/docs\/714"}],"next":[{"title":"Creating a New Advertiser","link":"https:\/\/wiki.pontiac.media\/?docs=api\/api-remarketing-campaign-tutorial\/creating-a-new-advertiser","href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/docs\/727"}],"prev":[{"title":"Tutorial Overview","link":"https:\/\/wiki.pontiac.media\/?docs=api\/api-remarketing-campaign-tutorial\/tutorial-overview","href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=\/wp\/v2\/docs\/6463"}],"wp:attachment":[{"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=724"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/wiki.pontiac.media\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}