Empty body content when doing a PUT request to Wiki pagesIs an entity body allowed for an HTTP DELETE request?HTTP GET with request bodyHow do you set the Content-Type header for an HttpClient request?I am trying to execute REST API within powershell using invoke-restmethod/invoke-webrequest but failed when I pass Json inputsInvoke-Webrequest incorect Json format “Cannot bind parameter 'Headers' ”VSTS create service connection via APIAzure DevOps git policy configurations api broken?Source Providers - List Branches - What is the providerName?is there any way to automate policykeys creation in identityexperienceframework under azure Ad B2C tenant?Update wiki page of tfs by calling rest-api
How to belay quickly ascending top-rope climbers?
How to get a type of "screech" on guitar
How do you send money when you're not sure it's not a scam?
Company looks for long-term employees, but I know I won't be interested in staying long
Why is Google approaching my VPS machine?
What is a Romeo Word™?
Should I have one hand on the throttle during engine ignition?
Why is regex [0-9]0,2 not greedy in sed?
Will copper pour help on my single-layer PCB?
Draw parts of a split rectangle in a dashed/dotted style
Why don't humans perceive sound waves as twice the frequency they are?
Transcendental and non-transcendental god and objectivism
How to tell readers that I know my story is factually incorrect?
Why would word of Princess Leia's capture generate sympathy for the Rebellion in the Senate?
Discontinuous Tube visualization
Could a US citizen born through "birth tourism" become President?
Integration using partial fraction is wrong
Pauli exclusion principle - black holes
Who is Jambavan an incarnation of?
Is encryption still applied if you ignore the SSL certificate warning for self-signed certs?
Why do jet engines sound louder on the ground than inside the aircraft?
Last-minute canceled work-trip means I'll lose thousands of dollars on planned vacation
Align the contents of a numerical matrix when you have minus signs
Why aren't there any women super Grandmasters (GMs)?
Empty body content when doing a PUT request to Wiki pages
Is an entity body allowed for an HTTP DELETE request?HTTP GET with request bodyHow do you set the Content-Type header for an HttpClient request?I am trying to execute REST API within powershell using invoke-restmethod/invoke-webrequest but failed when I pass Json inputsInvoke-Webrequest incorect Json format “Cannot bind parameter 'Headers' ”VSTS create service connection via APIAzure DevOps git policy configurations api broken?Source Providers - List Branches - What is the providerName?is there any way to automate policykeys creation in identityexperienceframework under azure Ad B2C tenant?Update wiki page of tfs by calling rest-api
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Azure DevOps Services REST API 5.0 - Wiki Pages
I'm trying to dynamically update an Azure DevOps Wiki page with the newest commits on top whenever a change is introduced to a repository.
When I try to PUT the commit history into a Wiki page the content field within the body is empty.

The request is done via Powershell and looks like this:
function postToWiki($Commits) ConvertTo-Json
Invoke-WebRequest -Uri $wikiUrl -Headers $headers -Body $json -ContentType "application/json" -Method Put
Additional information that can be useful:
- It works when I send simpler strings like "Hello"
- The JSON being sent is valid according to https://jsonlint.com/.
- The $Commit variable is pretty huge, up to 6000 lines.
rest azure powershell
add a comment |
Azure DevOps Services REST API 5.0 - Wiki Pages
I'm trying to dynamically update an Azure DevOps Wiki page with the newest commits on top whenever a change is introduced to a repository.
When I try to PUT the commit history into a Wiki page the content field within the body is empty.

The request is done via Powershell and looks like this:
function postToWiki($Commits) ConvertTo-Json
Invoke-WebRequest -Uri $wikiUrl -Headers $headers -Body $json -ContentType "application/json" -Method Put
Additional information that can be useful:
- It works when I send simpler strings like "Hello"
- The JSON being sent is valid according to https://jsonlint.com/.
- The $Commit variable is pretty huge, up to 6000 lines.
rest azure powershell
add a comment |
Azure DevOps Services REST API 5.0 - Wiki Pages
I'm trying to dynamically update an Azure DevOps Wiki page with the newest commits on top whenever a change is introduced to a repository.
When I try to PUT the commit history into a Wiki page the content field within the body is empty.

The request is done via Powershell and looks like this:
function postToWiki($Commits) ConvertTo-Json
Invoke-WebRequest -Uri $wikiUrl -Headers $headers -Body $json -ContentType "application/json" -Method Put
Additional information that can be useful:
- It works when I send simpler strings like "Hello"
- The JSON being sent is valid according to https://jsonlint.com/.
- The $Commit variable is pretty huge, up to 6000 lines.
rest azure powershell
Azure DevOps Services REST API 5.0 - Wiki Pages
I'm trying to dynamically update an Azure DevOps Wiki page with the newest commits on top whenever a change is introduced to a repository.
When I try to PUT the commit history into a Wiki page the content field within the body is empty.

The request is done via Powershell and looks like this:
function postToWiki($Commits) ConvertTo-Json
Invoke-WebRequest -Uri $wikiUrl -Headers $headers -Body $json -ContentType "application/json" -Method Put
Additional information that can be useful:
- It works when I send simpler strings like "Hello"
- The JSON being sent is valid according to https://jsonlint.com/.
- The $Commit variable is pretty huge, up to 6000 lines.
rest azure powershell
rest azure powershell
edited Mar 26 at 13:17
Jonathan Hellqvist
asked Mar 26 at 11:11
Jonathan HellqvistJonathan Hellqvist
335 bronze badges
335 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have the same problem today. My body contained special HTML caracters wich are not escaped in the request.
Try to escape the special chars (éè...).
In PowerShell, you can use the following assembly:
Add-Type -AssemblyName System.Web
$encodedBody = [System.Web.HttpUtility]::HtmlEncode($Commits)
Result:
# Construct the wiki REST URI
# $uri = $WikiUri +$WikiPath + $($contentPackage.version)
$uri = "$($env:WikiUri)$($contentPackage)&api-version=5.0"
# Encode and convert to json
Add-Type -AssemblyName System.Web
$encodedContent = [System.Web.HttpUtility]::HtmlEncode($content)
$data = @ Content=$encodedContent; | ConvertTo-Json;
# Set Request
$params = @uri = "$($uri)";
Method = 'PUT';
Headers = $header;
ContentType = "application/json";
Body = $data;
# Call
Invoke-WebRequest @params
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55355739%2fempty-body-content-when-doing-a-put-request-to-wiki-pages%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have the same problem today. My body contained special HTML caracters wich are not escaped in the request.
Try to escape the special chars (éè...).
In PowerShell, you can use the following assembly:
Add-Type -AssemblyName System.Web
$encodedBody = [System.Web.HttpUtility]::HtmlEncode($Commits)
Result:
# Construct the wiki REST URI
# $uri = $WikiUri +$WikiPath + $($contentPackage.version)
$uri = "$($env:WikiUri)$($contentPackage)&api-version=5.0"
# Encode and convert to json
Add-Type -AssemblyName System.Web
$encodedContent = [System.Web.HttpUtility]::HtmlEncode($content)
$data = @ Content=$encodedContent; | ConvertTo-Json;
# Set Request
$params = @uri = "$($uri)";
Method = 'PUT';
Headers = $header;
ContentType = "application/json";
Body = $data;
# Call
Invoke-WebRequest @params
add a comment |
I have the same problem today. My body contained special HTML caracters wich are not escaped in the request.
Try to escape the special chars (éè...).
In PowerShell, you can use the following assembly:
Add-Type -AssemblyName System.Web
$encodedBody = [System.Web.HttpUtility]::HtmlEncode($Commits)
Result:
# Construct the wiki REST URI
# $uri = $WikiUri +$WikiPath + $($contentPackage.version)
$uri = "$($env:WikiUri)$($contentPackage)&api-version=5.0"
# Encode and convert to json
Add-Type -AssemblyName System.Web
$encodedContent = [System.Web.HttpUtility]::HtmlEncode($content)
$data = @ Content=$encodedContent; | ConvertTo-Json;
# Set Request
$params = @uri = "$($uri)";
Method = 'PUT';
Headers = $header;
ContentType = "application/json";
Body = $data;
# Call
Invoke-WebRequest @params
add a comment |
I have the same problem today. My body contained special HTML caracters wich are not escaped in the request.
Try to escape the special chars (éè...).
In PowerShell, you can use the following assembly:
Add-Type -AssemblyName System.Web
$encodedBody = [System.Web.HttpUtility]::HtmlEncode($Commits)
Result:
# Construct the wiki REST URI
# $uri = $WikiUri +$WikiPath + $($contentPackage.version)
$uri = "$($env:WikiUri)$($contentPackage)&api-version=5.0"
# Encode and convert to json
Add-Type -AssemblyName System.Web
$encodedContent = [System.Web.HttpUtility]::HtmlEncode($content)
$data = @ Content=$encodedContent; | ConvertTo-Json;
# Set Request
$params = @uri = "$($uri)";
Method = 'PUT';
Headers = $header;
ContentType = "application/json";
Body = $data;
# Call
Invoke-WebRequest @params
I have the same problem today. My body contained special HTML caracters wich are not escaped in the request.
Try to escape the special chars (éè...).
In PowerShell, you can use the following assembly:
Add-Type -AssemblyName System.Web
$encodedBody = [System.Web.HttpUtility]::HtmlEncode($Commits)
Result:
# Construct the wiki REST URI
# $uri = $WikiUri +$WikiPath + $($contentPackage.version)
$uri = "$($env:WikiUri)$($contentPackage)&api-version=5.0"
# Encode and convert to json
Add-Type -AssemblyName System.Web
$encodedContent = [System.Web.HttpUtility]::HtmlEncode($content)
$data = @ Content=$encodedContent; | ConvertTo-Json;
# Set Request
$params = @uri = "$($uri)";
Method = 'PUT';
Headers = $header;
ContentType = "application/json";
Body = $data;
# Call
Invoke-WebRequest @params
answered Jun 25 at 16:17
JohnJohnJohnJohn
12 bronze badges
12 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55355739%2fempty-body-content-when-doing-a-put-request-to-wiki-pages%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown