{"id":1321,"date":"2020-01-21T12:46:05","date_gmt":"2020-01-21T12:46:05","guid":{"rendered":"http:\/\/dijitalturk.com\/veysel\/?p=1321"},"modified":"2020-01-21T12:47:03","modified_gmt":"2020-01-21T12:47:03","slug":"php-ile-servicenow-rest-api-cagirma","status":"publish","type":"post","link":"https:\/\/dijitalturk.com\/veysel\/php-ile-servicenow-rest-api-cagirma\/","title":{"rendered":"PHP ile ServiceNow Rest API \u00e7a\u011f\u0131rma"},"content":{"rendered":"<p>PHP script dilini kullanarak ServiceNow&#8217;da yam\u0131\u015f oldu\u011fumuz Scripted REST API \u00e7a\u011f\u0131rma kodunu a\u015fa\u011f\u0131da bulabilirsiniz.<\/p>\n<p><!--more--><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">\/\/ARRAYofHASH modelindeki verilerinizi dolduraca\u011f\u0131n\u0131z array tan\u0131mlamas\u0131.\r\n$data = array();\r\n\r\n\/*\r\n***\u00d6RNEK VER\u0130 MODEL\u0130***\r\n[{\"table_name\":\"incident\",\"record_sys_id\":\"79164747db310010cbe8f28239961943\",\"number\":\"123456\",\"fileFullPath\":\"demoFiles\/SWEP11.PNG\",\"fileName\":\"SWEP11.PNG\",\"fileMimeType\":\"\",\"fileB64\":\"B64FileString\"},{\"table_name\":\"incident\",\"record_sys_id\":\"79164747db310010cbe8f28239961943\",\"number\":\"123456\",\"fileFullPath\":\"demoFiles\/swep-2.jpg\",\"fileName\":\"swep-2.jpg\",\"fileMimeType\":\"\",\"fileB64\":\"B64FileString\"},{\"table_name\":\"incident\",\"record_sys_id\":\"79164747db310010cbe8f28239961943\",\"number\":\"123456\",\"fileFullPath\":\"demoFiles\/swep.zip\",\"fileName\":\"swep.zip\",\"fileMimeType\":\"\",\"fileB64\":\"B64FileString\"},{\"table_name\":\"incident\",\"record_sys_id\":\"79164747db310010cbe8f28239961943\",\"number\":\"123456\",\"fileFullPath\":\"demoFiles\/swep.msg\",\"fileName\":\"swep.msg\",\"fileMimeType\":\"\",\"fileB64\":\"B64FileString\"}]\r\n*\/\r\n\r\n$body = json_encode($data);\r\n\r\n$curl = curl_init();\r\n\r\ncurl_setopt_array($curl, array(\r\n  CURLOPT_URL =&gt; \"https:\/\/YOUR_INSTENCE_NAME.service-now.com\/api\/42684\/avt_attach\",\r\n  CURLOPT_RETURNTRANSFER =&gt; true,\r\n  CURLOPT_ENCODING =&gt; \"\",\r\n  CURLOPT_MAXREDIRS =&gt; 10,\r\n  CURLOPT_TIMEOUT =&gt; 0,\r\n  CURLOPT_FOLLOWLOCATION =&gt; true,\r\n  CURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1,\r\n  CURLOPT_CUSTOMREQUEST =&gt; \"POST\",\r\n  CURLOPT_POSTFIELDS =&gt; $body,\r\n  CURLOPT_HTTPHEADER =&gt; array(\r\n    \"Accept: application\/json\",\r\n    \"Content-Type: application\/json\",\r\n    \"Authorization: Basic xxx_YOUR_TOKEN_BASIC_OTANT\u0130KASYON_ANAHTARINIZ_xxx\"\r\n  ),\r\n));\r\n\r\n$response = curl_exec($curl);\r\n\r\ncurl_close($curl);\r\n\r\necho \"&lt;hr \/&gt;\";\r\necho $response;<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP script dilini kullanarak ServiceNow&#8217;da yam\u0131\u015f oldu\u011fumuz Scripted REST API \u00e7a\u011f\u0131rma kodunu a\u015fa\u011f\u0131da bulabilirsiniz.<\/p>\n","protected":false},"author":1,"featured_media":1099,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[185],"tags":[165,304,305,163],"class_list":["post-1321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-service-now","tag-php","tag-rest","tag-scripted-rest-api","tag-servicenow"],"uagb_featured_image_src":{"full":["https:\/\/dijitalturk.com\/veysel\/wp-content\/uploads\/2018\/12\/servicenow.png",600,315,false],"thumbnail":["https:\/\/dijitalturk.com\/veysel\/wp-content\/uploads\/2018\/12\/servicenow-150x150.png",150,150,true],"medium":["https:\/\/dijitalturk.com\/veysel\/wp-content\/uploads\/2018\/12\/servicenow-300x158.png",300,158,true],"medium_large":["https:\/\/dijitalturk.com\/veysel\/wp-content\/uploads\/2018\/12\/servicenow.png",600,315,false],"large":["https:\/\/dijitalturk.com\/veysel\/wp-content\/uploads\/2018\/12\/servicenow-600x315.png",600,315,true],"1536x1536":["https:\/\/dijitalturk.com\/veysel\/wp-content\/uploads\/2018\/12\/servicenow.png",600,315,false],"2048x2048":["https:\/\/dijitalturk.com\/veysel\/wp-content\/uploads\/2018\/12\/servicenow.png",600,315,false]},"uagb_author_info":{"display_name":"VeYSeL","author_link":"https:\/\/dijitalturk.com\/veysel\/author\/veysel\/"},"uagb_comment_info":0,"uagb_excerpt":"PHP script dilini kullanarak ServiceNow&#8217;da yam\u0131\u015f oldu\u011fumuz Scripted REST API \u00e7a\u011f\u0131rma kodunu a\u015fa\u011f\u0131da bulabilirsiniz.","_links":{"self":[{"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/posts\/1321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/comments?post=1321"}],"version-history":[{"count":0,"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/posts\/1321\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/media\/1099"}],"wp:attachment":[{"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/media?parent=1321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/categories?post=1321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dijitalturk.com\/veysel\/wp-json\/wp\/v2\/tags?post=1321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}