Graph API giving error in publish app to our catalog

Priyamvada Bhardwaj 0 Reputation points
2023-09-02T05:06:43.73+00:00

We are using Microsoft Teams Graph API to publish the app to our catalog

This is how we are using it

const zip = new JSZIP();

			zip.file("manifest.json", jsonData);
			zip.file("color.png", colorIconRes);
			zip.file("outline.png", outlineIconRes);

			//  Generate the zip
			const zipFileContent = await zip.generateAsync({ type: "nodebuffer" });

			const response = await graphClient.api('/appCatalogs/teamsApp')
				.post(zipFileContent);

But we are getting this error
Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format."

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,603 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,959 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,711 Reputation points
    2023-09-05T09:54:13.0433333+00:00

    Hello

    Thank you for your question and reaching out.

    This may be because your payload is not in a valid json format, this error occurs. You must remove the quotation marks. Instead of ", use ".

    https://learn.microsoft.com/en-us/answers/questions/193883/microsoft-graph-api-sharepoint-upload-files-gives

    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.