Adding a C-Sharp Script via Postman
Aug 15 2023 at 12:00 AM
- Introduction
- Getting a list of current Script Projects
- Adding or updating a Script Project
- Getting a list of all files associated with a Script Project
- Create and upload a new file
- 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
Type | GET |
---|---|
Url | https://{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
Type | POST |
---|---|
Url | https://{serviceUrl}/api/scriptproject/update |
Body | A 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
Type | GET |
---|---|
Url | https://{serviceUrl}/api/scriptproject/getall |
Example response:
[
{
"projectId": "Project1",
"fileId": "Script.cs",
"fileType": "SourceCode",
"lastUpdatedUtc": "2023-05-02T10:37:49.822Z"
}
]
To access the actual file content, the user needs to download the file. |
Create and upload a new file
- The user needs to create the file on their hard-drive.
- 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).
- Make the required changes to the file with the editor of choice.
- To upload the file, send the following request:
Type | POST |
---|---|
Url | https://{serviceUrl}/api/projectfile/upload/{projectId} |
Body | Select 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
Type | GET |
---|---|
Url | https://{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.