---
title: General
slug: api/general
description: Learn how to add a temporary file to your system using a multipart POST request with this detailed document. Find instructions on using the temporary file in subsequent calls, retrieving prepared files with a GET request, obtaining file checksums, and req
createdAt: 2023-07-04T09:04:22.623Z
---

## Add a Temporary File

:::CodeblockTabs
Endpoint

```HTTP
POST   {baseUrl}/fws/api/file
```
:::

:::BlockQuote
Multipart POST, for example:
:::

```json

Content-Type: multipart/form-data; boundary=----XXX
Authorization: Bearer 12345d-c123-1ce0-9893-0123456c83b

----XXX
Content-Disposition: form-data; name="file"; filename=".../odm.fdx"

(data)
----XXX
Content-Disposition: form-data; name="json"

{"requestId": "example123"}
----XXX


```

This request can be used to add a temporary file to the system. The temporary file can be used in any further calls which reference a file. For example, a file can be uploaded using this call, and then a File asset can be created that references it.

This request is sent as a [multipart/form-data](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2) POST request with the first part JSON and the second part being the file to stage.

If a file is staged successfully, the response will include the original `requestId` and the file reference.

:::BlockQuote
Example response:
:::

```json
{
  "requestId": "1234567890",
  "uuid": "2f4f2f22-6860-4312-aa5f-fb3ea6c595f9",
  "path": "stagedfile.xml"
}

```

**Errors:**

| **HTTP Status** | **Error Code**   |                                             |
| --------------- | ---------------- | ------------------------------------------- |
| 400             | malformed\_json  | The input JSON request is missing.          |
| 400             | file\_not\_found | The input file is missing from the request. |

See also [Common Errors](https://docs.formedix.com/api/common-errors)

## Retrieve a Previously Prepared File

:::CodeblockTabs
Endpoint

```HTTP
GET   {baseUrl}/fws/api/file/fileUUID
```
:::

:::BlockQuote
Replace `fileUUID` with the value from the previous request.
:::

Retrieve the previously prepared file specified by the `fileUUID` as a standard binary octet stream.

Should the file not yet be available, or no longer exist in the system, an appropriate HTTP response is returned.

The `fileUUID` is the UUID previously returned to the caller on a file generation request.

Files are removed from the system 7 days after their generation and the related UUID will no longer be valid. If a file is required after this period, the initial ‘request’ to generate the file can be re-performed (and a new UUID assigned).

The generated file must be saved as a .zip file.

:::CodeblockTabs
Response

```text
octet-stream of the file
```
:::

**Errors:**

| **HTTP Status** | **Error Code** |                                                                      |
| --------------- | -------------- | -------------------------------------------------------------------- |
| 400             | invalid\_uuid  | An invalid UUID was specified as the **fileUUID**.                   |
| 404             | unknown\_file  | The **fileUUID** specified does not match any known generated files. |

See also [Common Errors](https://docs.formedix.com/api/common-errors)

## Retrieve Checksums for a Previously Prepared File

:::CodeblockTabs
Endpoint

```HTTP
GET   {baseUrl}/fws/api/file/fileUUID/checksum
```
:::

Retrieve checksums for the previously prepared file as specified by the given `fileUUID`. If the file is not yet available or no longer exists in the system, an appropriate HTTP response is returned.

The `fileUUID` is the UUID previously returned to the caller on a file generation request.

Currently, only the MD5 hash of the file is returned.

:::BlockQuote
Example response:
:::

```json
{
  "md5": "0123456789abcdef0123456789abcdef"
}
```

**Errors:**

| **HTTP Status** | **Error Code**             |                                                                      |
| --------------- | -------------------------- | -------------------------------------------------------------------- |
| 400             | invalid\_uuid              | An invalid UUID was specified as the **fileUUID**.                   |
| 404             | unknown\_file              | The **fileUUID** specified does not match any known generated files. |
| 404             | file\_checksum\_not\_found | A file was found but it had no checksum stored.                      |

See also [Common Errors](https://docs.formedix.com/api/common-errors)

## Request a File Asset’s files

:::CodeblockTabs
Endpoint

```HTTP
GET   {baseUrl}/fws/api/repository/container/containerAID/containerVersion/asset/assetAID/files
```
:::

Retrieve the files associated with a File asset for the specified `assetAID` in `containerAID` and `containerVersion`. This request returns a UUID that can be used with the existing **Retrieve a previously prepared File** request.

:::BlockQuote
Example response:
:::

```json
{
  "uuid": "01234567-89ab-cdef-0123-456789abcdef"
}
```

**Errors:**

| **HTTP Status** | **Error Code**              |                                                                  |
| --------------- | --------------------------- | ---------------------------------------------------------------- |
| 400             | invalid\_container\_aid     | An invalid AdministeredID was specified as the **containerAID**. |
| 400             | invalid\_container\_version | A non numeric value was specified as the **version**.            |
| 400             | invalid\_asset\_aid         | An invalid AdministeredID was specified as the **assetAID**.     |
| 400             | invalid\_asset\_type        | If the supplied **assetAID** isn’t a **FILE** asset.             |
| 404             | unknown\_container          | Unknown **containerAID**/**version** pair.                       |
| 404             | unknown\_asset              | Unknown asset within the **containerAID**/**version** pair       |

See also [Common Errors](https://docs.formedix.com/api/common-errors)
