What is the significance of the `Content-Type` header when making `UrlFetchApp` requests?

Responsive Ad Header

Question

Grade: Education Subject: Support
What is the significance of the `Content-Type` header when making `UrlFetchApp` requests?
Asked by:
89 Viewed 89 Answers
Responsive Ad After Question

Answer (89)

Best Answer
(326)
The `Content-Type` header tells the API what format your request body is in (e.g., `application/json`, `application/xml`). Setting it to the correct value is essential for the API to properly parse your data. If you're sending JSON, set `Content-Type: application/json`. If sending XML, set `Content-Type: application/xml`.