Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
Post Request rejected with "Missing body content" error during Fetch

I am sending a Post request, with JavaScript Fetch method. The post attempts to create a Microsoft Teams chat message, via the Microsoft Graph Teams API. However, the server rejects the post request, with the message "missing body content". The payload shows the message body is being sent (Please see screenshot). It appears that the server is rejecting my Post request because it can not parse the body, which is in json format. Can anyone advise how I fix this Fetch issue? I've attached a code snippet for your review.

const data = {content: 'Hello Word'};
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer '+response.accessToken,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(data),
};

fetch(endpoint, options)
    .then((response)=>{
      const data = response.json();
      console.log("RESPONSE1:", data);
      return data;
    })
    .then((data)=>{
      console.log("RESPONSE2:", data);
      callback(data, endpoint);
    })
    .catch((error) => console.log("PUSHMSGRAPH-Error:", error));

Post Request

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try using the API and post it from the reference page with this API

POST /teams/{team-id}/channels/{channel-id}/messages

const teamId = '5834e4c1-2897-4cc3-b21900b56';
const threadid = '19:1df3a1d...@thread.tacv2';

const options = {
  authProvider,
};

const client = Client.init(options);

const chatMessage = {
  body: {
    content: 'Hello World'
  }
};


await client.api('/teams/' + teamId + '/channels/' + threadid + '/messages')
  .post(chatMessage);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!