{"id":1267,"date":"2017-02-06T08:11:31","date_gmt":"2017-02-06T15:11:31","guid":{"rendered":"https:\/\/toddbaginski.com\/blog\/?p=1267"},"modified":"2017-02-06T08:11:31","modified_gmt":"2017-02-06T15:11:31","slug":"how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient","status":"publish","type":"post","link":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/","title":{"rendered":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient"},"content":{"rendered":"<p>In my article <a href=\"https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/\" target=\"_blank\">How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part<\/a> I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/httpclient\" target=\"_blank\">httpClient <\/a>class.<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"XzwMN20sTx\"><p><a href=\"https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/\">How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part&#8221; &#8212; Todd Baginski&#039;s Blog\" src=\"https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/embed\/#?secret=5bXH3pu1cL#?secret=XzwMN20sTx\" data-secret=\"XzwMN20sTx\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers when making a request with\u00a0the SharePoint Framework (SPFx) <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/httpclient\" target=\"_blank\">httpClient <\/a>class. \u00a0Refer to the code snippet below.<\/p>\n<p>First, import <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/httpclient\" target=\"_blank\">httpClient<\/a>,\u00a0 <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/ihttpclientoptions\" target=\"_blank\">IHttpClientOptions<\/a>, and <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/httpclientresponse\" target=\"_blank\">HttpClientResponse <\/a> from the <a href=\"https:\/\/www.npmjs.com\/package\/@microsoft\/sp-http\" target=\"_blank\">@microsoft\/sp-http<\/a> npm package.<\/p>\n<p>To create the body for the POST request use <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/JSON\/stringify\" target=\"_blank\">JSON.stringify<\/a> for a JSON payload or manually create a JSON payload. \u00a0If you are not working with a JSON payload then assemble the body accordingly.<\/p>\n<p>To set the headers for the request, first create the Headers class and add the appropriate headers to it. \u00a0In this example you can see several commonly used headers. \u00a0Notice I show how to set the Authorization header for both OAuth 2.0 and Basic authentication scenarios. \u00a0<strong>You would never use both of these Authorization headers at the same time; I just included them both for reference.<\/strong><\/p>\n<p>Next, add the body and the headers to the <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/ihttpclientoptions\" target=\"_blank\">IHttpClientOptions<\/a> interface.<\/p>\n<p>Finally, invoke the appropriate method on the SPFx\u00a0<a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/httpclient\" target=\"_blank\">httpClient<\/a> to make the request. In this example, I am using the post method. \u00a0<strong><em>The approach is exactly the same when you use the get method.<\/em><\/strong><\/p>\n<p>When you call the post or get methods you pass in the following parameters:<\/p>\n<p><strong>url<\/strong> &#8211; the URL to fetch<br \/>\n<strong>configuration<\/strong> &#8211; determines the default behavior of HttpClient; normally this should be the latest version number from HttpClientConfigurations<br \/>\n<strong>options<\/strong> &#8211; additional options that affect the request<\/p>\n<p>The <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/httpclient\" target=\"_blank\">httpClient<\/a> returns a promise that contains the result.<\/p>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/TBag\/f9cc4ee5acdab75064abbfa78eb0b1c3.js\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/TBag\/f9cc4ee5acdab75064abbfa78eb0b1c3\">Gist<\/a>.<\/noscript><\/div>\n<p><strong>Note:<\/strong> I suggest you read <a href=\"http:\/\/www.sharepointnutsandbolts.com\/2016\/08\/async-rest-calls-promises-httpclient-jquery.html\">this article<\/a> by Chris O&#8217;Brien to learn more about the SPFx <a href=\"https:\/\/dev.office.com\/sharepoint\/reference\/spfx\/sp-http\/httpclient\" target=\"_blank\">httpClient<\/a>\u00a0class.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":1,"featured_media":1269,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[97,106],"tags":[10,6,7,115],"class_list":["post-1267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sharepoint","category-sharepoint-2016","tag-custom-development","tag-how-to-sharepoint","tag-sharepoint","tag-spfx"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Todd Baginski\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Todd Baginski&#039;s Blog - An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski&#039;s Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-02-06T15:11:31+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2017-02-06T15:11:31+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@toddbaginski\" \/>\n\t\t<meta name=\"twitter:title\" content=\"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski&#039;s Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@toddbaginski\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#blogposting\",\"name\":\"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski's Blog\",\"headline\":\"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient\",\"author\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/02\\\/Grand-View-Looking-Northwest.jpg\",\"width\":744,\"height\":301,\"caption\":\"Grand View Looking Northwest\"},\"datePublished\":\"2017-02-06T08:11:31-05:00\",\"dateModified\":\"2017-02-06T08:11:31-05:00\",\"inLanguage\":\"en\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#webpage\"},\"articleSection\":\"SharePoint, SharePoint 2016, Custom Development, HOW TO: SharePoint, SharePoint, SPFx\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/toddbaginski.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/#listItem\",\"name\":\"SharePoint\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/#listItem\",\"position\":2,\"name\":\"SharePoint\",\"item\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2016\\\/#listItem\",\"name\":\"SharePoint 2016\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2016\\\/#listItem\",\"position\":3,\"name\":\"SharePoint 2016\",\"item\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2016\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#listItem\",\"name\":\"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/#listItem\",\"name\":\"SharePoint\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#listItem\",\"position\":4,\"name\":\"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/category\\\/sharepoint\\\/sharepoint-2016\\\/#listItem\",\"name\":\"SharePoint 2016\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#person\",\"name\":\"Todd Baginski\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/\",\"name\":\"Todd Baginski\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#webpage\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/\",\"name\":\"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski's Blog\",\"description\":\"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\\\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers\",\"inLanguage\":\"en\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/author\\\/todd\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/02\\\/Grand-View-Looking-Northwest.jpg\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#mainImage\",\"width\":744,\"height\":301,\"caption\":\"Grand View Looking Northwest\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\\\/#mainImage\"},\"datePublished\":\"2017-02-06T08:11:31-05:00\",\"dateModified\":\"2017-02-06T08:11:31-05:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/\",\"name\":\"Todd Baginski's Blog\",\"description\":\"An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog\",\"inLanguage\":\"en\",\"publisher\":{\"@id\":\"https:\\\/\\\/toddbaginski.com\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski's Blog","description":"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers","canonical_url":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#blogposting","name":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski's Blog","headline":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient","author":{"@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author"},"publisher":{"@id":"https:\/\/toddbaginski.com\/blog\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2017\/02\/Grand-View-Looking-Northwest.jpg","width":744,"height":301,"caption":"Grand View Looking Northwest"},"datePublished":"2017-02-06T08:11:31-05:00","dateModified":"2017-02-06T08:11:31-05:00","inLanguage":"en","mainEntityOfPage":{"@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#webpage"},"isPartOf":{"@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#webpage"},"articleSection":"SharePoint, SharePoint 2016, Custom Development, HOW TO: SharePoint, SharePoint, SPFx"},{"@type":"BreadcrumbList","@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/toddbaginski.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/#listItem","name":"SharePoint"}},{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/#listItem","position":2,"name":"SharePoint","item":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/","nextItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2016\/#listItem","name":"SharePoint 2016"},"previousItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2016\/#listItem","position":3,"name":"SharePoint 2016","item":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2016\/","nextItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#listItem","name":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient"},"previousItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/#listItem","name":"SharePoint"}},{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#listItem","position":4,"name":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient","previousItem":{"@type":"ListItem","@id":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2016\/#listItem","name":"SharePoint 2016"}}]},{"@type":"Person","@id":"https:\/\/toddbaginski.com\/blog\/#person","name":"Todd Baginski"},{"@type":"Person","@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author","url":"https:\/\/toddbaginski.com\/blog\/author\/todd\/","name":"Todd Baginski"},{"@type":"WebPage","@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#webpage","url":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/","name":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski's Blog","description":"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers","inLanguage":"en","isPartOf":{"@id":"https:\/\/toddbaginski.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#breadcrumblist"},"author":{"@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author"},"creator":{"@id":"https:\/\/toddbaginski.com\/blog\/author\/todd\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2017\/02\/Grand-View-Looking-Northwest.jpg","@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#mainImage","width":744,"height":301,"caption":"Grand View Looking Northwest"},"primaryImageOfPage":{"@id":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/#mainImage"},"datePublished":"2017-02-06T08:11:31-05:00","dateModified":"2017-02-06T08:11:31-05:00"},{"@type":"WebSite","@id":"https:\/\/toddbaginski.com\/blog\/#website","url":"https:\/\/toddbaginski.com\/blog\/","name":"Todd Baginski's Blog","description":"An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog","inLanguage":"en","publisher":{"@id":"https:\/\/toddbaginski.com\/blog\/#person"}}]},"og:locale":"en_US","og:site_name":"Todd Baginski's Blog - An AI, SharePoint, Office 365, Azure, Power Apps, Power Platform, and Mobile Blog","og:type":"article","og:title":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski's Blog","og:description":"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers","og:url":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/","og:image":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg","og:image:secure_url":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg","article:published_time":"2017-02-06T15:11:31+00:00","article:modified_time":"2017-02-06T15:11:31+00:00","twitter:card":"summary","twitter:site":"@toddbaginski","twitter:title":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient - Todd Baginski's Blog","twitter:description":"In my article How To: Run a Microsoft Flow from a SharePoint Framework (SPFx) web part I set the headers and body when I called a Microsoft Flow with the SharePoint Framework (SPFx) httpClient class. https:\/\/toddbaginski.com\/blog\/how-to-run-a-microsoft-flow-from-a-sharepoint-framework-spfx-web-part\/ In this post, I have simplified the code to succinctly demonstrate how to set the body and request headers","twitter:creator":"@toddbaginski","twitter:image":"https:\/\/toddbaginski.com\/blog\/wp-content\/uploads\/2019\/09\/todd-400x400.jpg"},"aioseo_meta_data":{"post_id":"1267","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2022-02-14 14:53:45","updated":"2025-06-03 21:12:53"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/toddbaginski.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/\" title=\"SharePoint\">SharePoint<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2016\/\" title=\"SharePoint 2016\">SharePoint 2016<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/toddbaginski.com\/blog"},{"label":"SharePoint","link":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/"},{"label":"SharePoint 2016","link":"https:\/\/toddbaginski.com\/blog\/category\/sharepoint\/sharepoint-2016\/"},{"label":"HOW TO: Set the body and headers for the SharePoint Framework (SPFx) httpClient","link":"https:\/\/toddbaginski.com\/blog\/how-to-set-the-body-and-headers-for-the-sharepoint-framework-spfx-httpclient\/"}],"_links":{"self":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts\/1267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/comments?post=1267"}],"version-history":[{"count":1,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts\/1267\/revisions"}],"predecessor-version":[{"id":1268,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/posts\/1267\/revisions\/1268"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/media\/1269"}],"wp:attachment":[{"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/media?parent=1267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/categories?post=1267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/toddbaginski.com\/blog\/wp-json\/wp\/v2\/tags?post=1267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}