Class HTTPResponse
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
HTTP প্রতিক্রিয়া এই ক্লাসটি ব্যবহারকারীদের HTTP প্রতিক্রিয়াগুলিতে নির্দিষ্ট তথ্য অ্যাক্সেস করতে দেয়।
এছাড়াও দেখুন
পদ্ধতি
পদ্ধতি | রিটার্ন টাইপ | সংক্ষিপ্ত বিবরণ |
---|
get All Headers() | Object | HTTP প্রতিক্রিয়ার জন্য শিরোনামগুলির একটি বৈশিষ্ট্য/মান মানচিত্র প্রদান করে, যে শিরোনামগুলির একাধিক মান অ্যারে হিসাবে ফিরে আসে। |
get As(contentType) | Blob | নির্দিষ্ট বিষয়বস্তুর প্রকারে রূপান্তরিত একটি ব্লব হিসাবে এই বস্তুর ভিতরের ডেটা ফেরত দিন। |
get Blob() | Blob | একটি ব্লব হিসাবে এই বস্তুর ভিতরে ডেটা ফেরত দিন। |
get Content() | Byte[] | একটি HTTP প্রতিক্রিয়ার কাঁচা বাইনারি সামগ্রী পায়। |
get Content Text() | String | একটি স্ট্রিং হিসাবে এনকোড করা একটি HTTP প্রতিক্রিয়ার বিষয়বস্তু পায়৷ |
get Content Text(charset) | String | প্রদত্ত অক্ষরসেটের একটি স্ট্রিং হিসাবে এনকোড করা HTTP প্রতিক্রিয়ার বিষয়বস্তু ফেরত দেয়। |
get Headers() | Object | HTTP প্রতিক্রিয়ার জন্য হেডারগুলির একটি বৈশিষ্ট্য/মান মানচিত্র প্রদান করে। |
get Response Code() | Integer | একটি HTTP প্রতিক্রিয়ার HTTP স্ট্যাটাস কোড (OK এর জন্য 200, ইত্যাদি) পান। |
বিস্তারিত ডকুমেন্টেশন
get As(contentType)
নির্দিষ্ট বিষয়বস্তুর প্রকারে রূপান্তরিত একটি ব্লব হিসাবে এই বস্তুর ভিতরের ডেটা ফেরত দিন। এই পদ্ধতিটি ফাইলের নামের সাথে উপযুক্ত এক্সটেনশন যোগ করে—উদাহরণস্বরূপ, "myfile.pdf"। যাইহোক, এটি অনুমান করে যে ফাইলের নামের অংশ যা শেষ সময়কাল অনুসরণ করে (যদি থাকে) একটি বিদ্যমান এক্সটেনশন যা প্রতিস্থাপন করা উচিত। ফলস্বরূপ, "ShoppingList.12.25.2014" "ShoppingList.12.25.pdf" হয়ে যায়।
রূপান্তরের জন্য দৈনিক কোটা দেখতে, Google পরিষেবাগুলির জন্য কোটা দেখুন। নতুন তৈরি করা Google Workspace ডোমেন সাময়িকভাবে কঠোর কোটার অধীন হতে পারে।
পরামিতি
নাম | টাইপ | বর্ণনা |
---|
content Type | String | MIME প্রকারে রূপান্তর করতে হবে৷ বেশিরভাগ ব্লবের জন্য, 'application/pdf' একমাত্র বৈধ বিকল্প। BMP, GIF, JPEG, বা PNG ফর্ম্যাটে ছবির জন্য, 'image/bmp' , 'image/gif' , 'image/jpeg' , বা 'image/png' এর যেকোনো একটিও বৈধ। একটি Google ডক্স ডকুমেন্টের জন্য, 'text/markdown' বৈধ। |
প্রত্যাবর্তন
Blob
- একটি ব্লব হিসাবে ডেটা।
get Blob()
একটি ব্লব হিসাবে এই বস্তুর ভিতরে ডেটা ফেরত দিন।
প্রত্যাবর্তন
Blob
- একটি ব্লব হিসাবে ডেটা।
get Content()
একটি HTTP প্রতিক্রিয়ার কাঁচা বাইনারি সামগ্রী পায়।
// The code below logs the value of the first byte of the Google home page.
const response = UrlFetchApp.fetch('http://www.google.com/');
Logger.log(response.getContent()[0]);
প্রত্যাবর্তন
Byte[]
— একটি কাঁচা বাইনারি অ্যারে হিসাবে বিষয়বস্তু
get Content Text()
একটি স্ট্রিং হিসাবে এনকোড করা একটি HTTP প্রতিক্রিয়ার বিষয়বস্তু পায়৷
// The code below logs the HTML code of the Google home page.
const response = UrlFetchApp.fetch('http://www.google.com/');
Logger.log(response.getContentText());
প্রত্যাবর্তন
String
— HTTP প্রতিক্রিয়ার বিষয়বস্তু, একটি স্ট্রিং হিসাবে
get Content Text(charset)
প্রদত্ত অক্ষরসেটের একটি স্ট্রিং হিসাবে এনকোড করা HTTP প্রতিক্রিয়ার বিষয়বস্তু ফেরত দেয়।
// The code below logs the HTML code of the Google home page with the UTF-8
// charset.
const response = UrlFetchApp.fetch('http://www.google.com/');
Logger.log(response.getContentText('UTF-8'));
পরামিতি
নাম | টাইপ | বর্ণনা |
---|
charset | String | HTTP প্রতিক্রিয়া বিষয়বস্তু এনকোডিংয়ের জন্য ব্যবহৃত অক্ষরসেটের প্রতিনিধিত্বকারী একটি স্ট্রিং |
প্রত্যাবর্তন
String
— HTTP প্রতিক্রিয়ার বিষয়বস্তু, প্রদত্ত অক্ষর সেট ব্যবহার করে এনকোড করা হয়েছে
get Response Code()
একটি HTTP প্রতিক্রিয়ার HTTP স্ট্যাটাস কোড (OK এর জন্য 200, ইত্যাদি) পান।
// The code below logs the HTTP status code from the response received
// when fetching the Google home page.
// It should be 200 if the request succeeded.
const response = UrlFetchApp.fetch('http://www.google.com/');
Logger.log(response.getResponseCode());
প্রত্যাবর্তন
Integer
— HTTP প্রতিক্রিয়া কোড (উদাহরণস্বরূপ, ঠিক আছে 200)।
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-08 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-08 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThe \u003ccode\u003eHTTPResponse\u003c/code\u003e class provides access to data and metadata returned from an HTTP request made by \u003ccode\u003eUrlFetchApp\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods to retrieve content as raw bytes, string, or blob, and to get headers or the response code.\u003c/p\u003e\n"],["\u003cp\u003eContent can be retrieved in various formats, including blob and string, with options for content type conversion.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access HTTP headers to get detailed response information for debugging or further processing.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eHTTPResponse\u003c/code\u003e helps developers work with HTTP responses received by \u003ccode\u003eUrlFetchApp\u003c/code\u003e within Apps Script.\u003c/p\u003e\n"]]],[],null,["# Class HTTPResponse\n\nHTTPResponse\n\nThis class allows users to access specific information on HTTP responses.\n\n#### See also\n\n- [UrlFetchApp](/apps-script/reference/url-fetch/url-fetch-app) \n\n### Methods\n\n| Method | Return type | Brief description |\n|----------------------------------------------------|---------------------------|-----------------------------------------------------------------------------------------------------------------------------|\n| [getAllHeaders()](#getAllHeaders()) | `Object` | Returns an attribute/value map of headers for the HTTP response, with headers that have multiple values returned as arrays. |\n| [getAs(contentType)](#getAs(String)) | [Blob](../base/blob.html) | Return the data inside this object as a blob converted to the specified content type. |\n| [getBlob()](#getBlob()) | [Blob](../base/blob.html) | Return the data inside this object as a blob. |\n| [getContent()](#getContent()) | `Byte[]` | Gets the raw binary content of an HTTP response. |\n| [getContentText()](#getContentText()) | `String` | Gets the content of an HTTP response encoded as a string. |\n| [getContentText(charset)](#getContentText(String)) | `String` | Returns the content of an HTTP response encoded as a string of the given charset. |\n| [getHeaders()](#getHeaders()) | `Object` | Returns an attribute/value map of headers for the HTTP response. |\n| [getResponseCode()](#getResponseCode()) | `Integer` | Get the HTTP status code (200 for OK, etc.) of an HTTP response. |\n\nDetailed documentation\n----------------------\n\n### `get``All``Headers()`\n\nReturns an attribute/value map of headers for the HTTP response, with headers that have\nmultiple values returned as arrays.\n\n```javascript\n// The code below logs the HTTP headers from the response\n// received when fetching the Google home page.\nconst response = UrlFetchApp.fetch('http://www.google.com/');\nLogger.log(response.getAllHeaders());\n```\n\n#### Return\n\n\n`Object` --- a JavaScript key/value map of HTTP headers\n\n*** ** * ** ***\n\n### `get``As(contentType)`\n\nReturn the data inside this object as a blob converted to the specified content type. This\nmethod adds the appropriate extension to the filename---for example, \"myfile.pdf\". However, it\nassumes that the part of the filename that follows the last period (if any) is an existing\nextension that should be replaced. Consequently, \"ShoppingList.12.25.2014\" becomes\n\"ShoppingList.12.25.pdf\".\n\nTo view the daily quotas for conversions, see [Quotas for Google\nServices](https://developers.google.com/apps-script/guides/services/quotas). Newly created Google Workspace domains might be temporarily subject to stricter\nquotas.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `content``Type` | `String` | The MIME type to convert to. For most blobs, `'application/pdf'` is the only valid option. For images in BMP, GIF, JPEG, or PNG format, any of `'image/bmp'`, `'image/gif'`, `'image/jpeg'`, or `'image/png'` are also valid. For a Google Docs document, `'text/markdown'` is also valid. |\n\n#### Return\n\n\n[Blob](../base/blob.html) --- The data as a blob.\n\n*** ** * ** ***\n\n### `get``Blob()`\n\nReturn the data inside this object as a blob.\n\n#### Return\n\n\n[Blob](../base/blob.html) --- The data as a blob.\n\n*** ** * ** ***\n\n### `get``Content()`\n\nGets the raw binary content of an HTTP response.\n\n```javascript\n// The code below logs the value of the first byte of the Google home page.\nconst response = UrlFetchApp.fetch('http://www.google.com/');\nLogger.log(response.getContent()[0]);\n```\n\n#### Return\n\n\n`Byte[]` --- the content as a raw binary array\n\n*** ** * ** ***\n\n### `get``Content``Text()`\n\nGets the content of an HTTP response encoded as a string.\n\n```javascript\n// The code below logs the HTML code of the Google home page.\nconst response = UrlFetchApp.fetch('http://www.google.com/');\nLogger.log(response.getContentText());\n```\n\n#### Return\n\n\n`String` --- the content of the HTTP response, as a string\n\n*** ** * ** ***\n\n### `get``Content``Text(charset)`\n\nReturns the content of an HTTP response encoded as a string of the given charset.\n\n```javascript\n// The code below logs the HTML code of the Google home page with the UTF-8\n// charset.\nconst response = UrlFetchApp.fetch('http://www.google.com/');\nLogger.log(response.getContentText('UTF-8'));\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|----------|-------------------------------------------------------------------------------------|\n| `charset` | `String` | a string representing the charset to be used for encoding the HTTP response content |\n\n#### Return\n\n\n`String` --- the content of the HTTP response, encoded using the given charset\n\n*** ** * ** ***\n\n### `get``Headers()`\n\nReturns an attribute/value map of headers for the HTTP response.\n\n```javascript\n// The code below logs the HTTP headers from the response\n// received when fetching the Google home page.\nconst response = UrlFetchApp.fetch('http://www.google.com/');\nLogger.log(response.getHeaders());\n```\n\n#### Return\n\n\n`Object` --- a JavaScript key/value map of HTTP headers\n\n*** ** * ** ***\n\n### `get``Response``Code()`\n\nGet the HTTP status code (200 for OK, etc.) of an HTTP response.\n\n```javascript\n// The code below logs the HTTP status code from the response received\n// when fetching the Google home page.\n// It should be 200 if the request succeeded.\nconst response = UrlFetchApp.fetch('http://www.google.com/');\nLogger.log(response.getResponseCode());\n```\n\n#### Return\n\n\n`Integer` --- The HTTP response code (for example, 200 for OK)."]]