Home > Misc > Post a File and Data to SandBlast API using Postman and generate C# code

Post a File and Data to SandBlast API using Postman and generate C# code

We got a requirement to use SandBlast Threat Extraction  process, for cleansing the files.

SandBlast Threat Extraction, is a solution by ‘Check Point’ company,  which removes exploitable content, including active content and embedded objects, reconstructs files to eliminate potential threats.

‘Threat Extraction’ Upload API, requires following parameters

  • Header
    • Authorization
    • Content-Type
  • Body
    • File Content
    • request (This is string)

If you notice, we need to pass ‘File’ as well as ‘Data’ to the API.

As of now, Sandblast doesn’t have a native .Net library to make API calls. So I’ve used Postman tool as a starting point for my development.

Below is the step-by-step, to pass ‘File’ and ‘Data’ in request ‘Body’, using Postman

  • Open Postman tool
  • Create a new ‘Request’

PM_2

  • Set the method as ‘Post’ and URL.
  • From the ‘Body’ tab, select ‘form-data’ option
  • To pass the ‘File’,  add a new ‘KEY’ of type ‘File’ and browse the file in ‘VALUE’ parameter.
  • To pass the ‘Data’, add a new ‘KEY’ of type ‘Text’ and set the ‘VALUE’

PM_1

Generate C# code from the Request:

  • Postman has an amazing feature to generate the code in your required language.
  • Click on ‘Code’ link and for C#, choose ‘C# (RestSharp)’ option.

PM_3

If anyone having struggling to use Sandblast API’s, post in comments section and I will address.

🙂

 

Advertisement
Categories: Misc Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: