Upload File

Upload file supports uploading a file and overwriting an uploaded file.

Before you begin

Before attempting to submit a request with this API, you must ensure that the following permissions are available:
  • Automation > Workflow > Import
You can check this in the Platform module under IDENTITY > Role > Authorized functions.

Request Structure

Endpoint: /visualworkflow-file-operation-upload
Type: POST
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/visualworkflow-file-operation-upload?gwsource=external
Headers:
Content-Type: application/json
Understanding the sample URL
  • IP/HostName/TenantName: Replace with the actual IP address, hostname, or tenant name based on the specific configuration in AppViewX.
    • IP: A unique identifier assigned to each device connected to a computer network that uses the Internet Protocol for communication

      The IP address will be included in the endpoint URL for an on-prem deployment.

    • HostName: A human-readable label assigned to a device (host) on a network

      The hostname will be included in the endpoint URL for an on-prem deployment.

    • TenantName: An identifier label for a tenant given to indicate which tenant's data the API request will access/modify

      The tenant name will be included in the endpoint URL for a SaaS deployment.

  • GWPORT: AppViewX gateway port

    A gateway port refers to a network port through which data is sent and received to communicate with a gateway in an on-prem deployment.

    Example: 31443

  • avxapi: Path parameter value (static) that is part of the endpoint's URL
  • Endpoint: Endpoint of the API, for example: execute-hook
  • gwsource: Source or origin of a gateway, for example: external.
Table 1. Input Parameters
Name Description
sessionID

Header

(Mandatory) Use session ID retrieved from login API is required if username and password are not provided.

Example: "sessionId": "ce7f1a14-2bf9-4e4a-89a8-bc780a255813"

username

Header

(Mandatory) AppViewX login username is required if sessionId is not provided.

Example: "admin"

Password

Header

(Mandatory) AppViewX login password is required if sessionId is not provided..

Example: "AppViewX@123"

Content-Type

Header

(Mandatory) The parameter should be set to application/json to specify the nature of the data in the payload.

Example: "application/json"

gwsource

Query

(Mandatory) Source from which the request is triggered.
The values can be:
  • web
  • external
Payload (Mandatory) Input data for request body in application/json format. For payload details, see Payload section.
Table 2. Payload
Name Description
fileName

String

(Mandatory) Name of the file, allowed file formats : img, jpg, jpeg, png, doc, pdf, txt, gif, zip, ppt, pptx, xls, xlsx, csv, p7b, p7c, pfx, p12, der, pem, csr, crt, cer, key.

Example: "sample.zip"

uniqueId

String

(Mandatory) Unique ID for the file being uploaded.

Example: "651baff382ca812a7cbf4baa"

fileOverWrite

Boolean

(Mandatory) Determines whether to overwrite the file being uploaded if a file with the same uniqueId exists.

False (Upload file only if a file with same uniqueId not present.)

True (Upload file and overwrite if file with same uniqueId is present. If not, then upload the given file.)

Example: "false/true"

file

Binary

(Mandatory) File to be uploaded.

Example: "<%File to be uploaded%>"

Response Structure

  • Status Code: 200 OK
  • Message: File Uploaded successfully
  • Headers:
    • Content-Type: application/json
Table 3. Response Parameters
Name Description
response

Key value pair

Contains the response object along with the hierarchy of the object mapped in field children.
message

String

Success message or failure description in case of error.
appStatusCode

String

Application specific status code for the response. Will be non-null for failure response.
tags

NA

More info in case of failure response.

Status Codes

HTTP Code appStatusCode Message and Remediation
200 OK NA Success
400 Bad Request StudioService_078 UniqueId field not found.

Possible Remediation: Check and ensure if valid uniqueId is given.

400 Bad Request StudioService_084 Data cannot be null or empty.

Possible Remediation: Check and ensure if valid data is provided.

400 Bad Request StudioService_077 File content not found.

Possible Remediation: Check and ensure for valid file.

400 Bad Request StudioService_071 Invalid file name.

Possible Remediation: Check and ensure if valid fileName is given.

400 Bad Request StudioService_076 File Name not found.

Possible Remediation: Check and ensure if valid fileName is given

400 Bad Request StudioService_040 Invalid field format

Possible Remediation: Check and ensure if valid file and fileName is given.

400 Bad Request StudioService_075 File with uniqueId already exists.

Sample Request/Response

Use Case 1: Upload file

Upload file to collection.

Request URL
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/visualworkflow-file-operation-upload?gwsource=external
Request Payload
{
  "payload": {
	“fileName”:”sample.zip”,
	“uniqueId”:”uniqueId”,
	“fileOverWrite”:false,
	“file”:<%File to be uploaded%>
  }
}
Sample Response
{
  "response": "File Uploaded successfully",
  "message": null,
  "appStatusCode": null,
  "tags": null,
  "headers": null
}
Use Case 2: Overwrite file

Overwrite file: Upload a file and overwrite if a file with the same uniqueID is present in the database.

Request URL
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/visualworkflow-file-operation-upload?gwsource=external
Request Payload
{
  "payload": {
	“fileName”:”sample.zip”,
	“uniqueId”:”uniqueId”,
	“fileOverWrite”:true,
	“file”:<%File to be uploaded%>
  }
}
Sample Response
{
  "response": "File Uploaded successfully",
  "message": "File Uploaded successfully",
  "appStatusCode": null,
  "tags": null,
  "headers": null
}