# Get file metadata GET https://content-gateway-example.com/v1/files/{id} Retrieves metadata for content resource Reference: https://docs.moveworks.com/api-reference/content-gateway/get-file-metadata ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get file metadata version: endpoint_.getFileMetadata paths: /files/{id}: get: operationId: get-file-metadata summary: Get file metadata description: | Retrieves metadata for content resource tags: - [] parameters: - name: id in: path required: true schema: type: string format: uuid responses: '200': description: Successfully retrieved metadata of content content: application/json: schema: $ref: '#/components/schemas/ODataContentMetadataResponse' '400': description: >- Bad Request - The request could not be understood by the server due to malformed syntax. content: {} '401': description: >- Unauthorized - Authentication is required and has failed or has not yet been provided. content: {} '403': description: >- Forbidden - Server understood the request but refuses to authorize it. content: {} '404': description: Not Found - The requested file could not be found. content: {} '429': description: Too Many Requests - Rate limit exceeded. content: {} '500': description: >- Internal Server Error - The server encountered an unexpected condition that prevented it from fulfilling the request. content: {} components: schemas: status_enum: type: string enum: - value: active - value: deleted custom_attributes: type: object additionalProperties: type: string NodeContent: type: object properties: download_path: type: string description: >- URL for the download request, most likely `/files/{id}/download`. *Either `download_path` OR `body` MUST be provided.* body: type: string description: >- The HTML representation of the object. If `mime_type` is `text/html` and `download_path` is not provided, this will be ingested as the content of the document. *Either `download_path` OR `body` MUST be provided.* mime_type: type: string description: >- Used to specify type of content. See our supported MIME types here: https://help.moveworks.com/reference/supported-mime-types. size: type: integer format: int64 sha1_hash: type: string required: - mime_type node_reference: type: object properties: id: type: string format: uuid name: type: string path: type: string required: - id - name Node: type: object properties: id: type: string format: uuid description: Unique id for each file name: type: string description: User friendly name for the file status: $ref: '#/components/schemas/status_enum' custom_attributes: $ref: '#/components/schemas/custom_attributes' last_modified_datetime: type: string format: date-time description: Used to efficiently ingest content only updated since last ingestion last_modified_by: type: string created_datetime: type: string format: date-time created_by: type: string external_url: type: string description: External URL to redirect users metadata_url: type: string description: Used to retrieve metadata about individual files content: $ref: '#/components/schemas/NodeContent' parent_info: $ref: '#/components/schemas/node_reference' children_url: type: string required: - id - name - last_modified_datetime - external_url ODataContentMetadataResponse: type: object properties: '@odata.context': type: string description: URL to the metadata of the response. value: $ref: '#/components/schemas/Node' ``` ## SDK Code Examples ```python import requests url = "https://content-gateway-example.com/v1/files/id" response = requests.get(url) print(response.json()) ``` ```javascript const url = 'https://content-gateway-example.com/v1/files/id'; const options = {method: 'GET'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://content-gateway-example.com/v1/files/id" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://content-gateway-example.com/v1/files/id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://content-gateway-example.com/v1/files/id") .asString(); ``` ```php request('GET', 'https://content-gateway-example.com/v1/files/id'); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://content-gateway-example.com/v1/files/id"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://content-gateway-example.com/v1/files/id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```