Link Search Menu Expand Document

Adding a C-Sharp Script via Postman

Aug 15 2023 at 12:00 AM

  1. Introduction
  2. Getting a list of current Script Projects
  3. Adding or updating a Script Project
  4. Getting a list of all files associated with a Script Project
  5. Create and upload a new file
  6. Download a Script Project File

Introduction

All postman calls require a V-Raptor generated API Key with each request for authentication. The API for scripts is divided into two sections:

  • ScriptProject - deals with project details.
  • ProjectFile - deals with the code files associated with the project.

Getting a list of current Script Projects

TypeGET
Urlhttps://{serviceUrl}/api/scriptproject/getall

Example response:

[
    {
        "ProjectId": "Project1",
        "Language": "CSharp",
        "Description": "Generic test project.",
        "LastUpdatedUtc": "2023-05-02T10:25:02.157Z"
    }
]

Adding or updating a Script Project

TypePOST
Urlhttps://{serviceUrl}/api/scriptproject/update
BodyA json document containing the project details. <pre/>{
“projectId”: “Project1”,
“language”: “CSharp”,
“description”: “Description of the project”
}

Getting a list of all files associated with a Script Project

TypeGET
Urlhttps://{serviceUrl}/api/scriptproject/getall

Example response:

[
    {
        "projectId": "Project1",
        "fileId": "Script.cs",
        "fileType": "SourceCode",
        "lastUpdatedUtc": "2023-05-02T10:37:49.822Z"
    }
]
NOTE
To access the actual file content, the user needs to download the file.

Create and upload a new file

  1. The user needs to create the file on their hard-drive.
  2. If the user is creating a new C-Sharp Script Filter for a Generic Driver, copy the sample template code from here and save it to a file (e.g. Script.cs).
  3. Make the required changes to the file with the editor of choice.
  4. To upload the file, send the following request:
TypePOST
Urlhttps://{serviceUrl}/api/projectfile/upload/{projectId}
BodySelect form-data
Set the key to the file name (“Script.cs”)
Drop down the key type and select File.
In the value, click ‘Select Files’ and select the file you created (Script.cs)

Download a Script Project File

TypeGET
Urlhttps://{serviceUrl}/api/projectfile/download/{projectId}/{fileId}

The response will contain the text of the file. Save this to the disk to work on the file.