title: Connect to a Rest API, using a postman collection
body: <p>I'm trying to connect to an API that I have a Postman Collection json:</p>
  
  <pre><code>{
      "info": {
          "_postman_id": "----",
          "name": "Public API",
          "description": "API",
          "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
      },
  "item": [
          {
              "name": "Add Bim Info for a building",
              "request": {
                  "auth": {
                      "type": "basic",
                      "basic": [
                          {
                              "key": "password",
                              "value": "somepassword",
                              "type": "string"
                          },
                          {
                              "key": "username",
                              "value": "someusername",
                              "type": "string"
                          }
                      ]
                  },
                  "method": "POST",
                  "header": [],
                  "body": {
                      "mode": "formdata",
                      "formdata": [
                          {
                              "key": "file",
                              "type": "file",
                              "src": []
                          }
                      ]
                  },
                  "url": {
                      "raw": "http://00.00.00.00:0000/api/apiName/building/",
                      "protocol": "http",
                      "host": [
                          "00",
                          "00",
                          "00",
                          "00"
                      ],
                      "port": "0000",
                      "path": [
                          "api",
                          "apiName",
                          "building",
                          ""
                      ]
                  },
                  "description": "description"
              },
              "response": []
          }
  ]
  </code></pre>
  
  <p>When I load this json to <code>postman</code> I can send files without problem, but I have to implement a console program to do it, so I've tried to translate the postman collection to c# code using <code>RestSharp</code>:</p>
  
  <pre><code>    string filePath = @"path_to_file";
      string url = "http://00.00.00.00:0000/api/apiName/building/";
      string usr = "someuser";
      string pwd = "somepassword";
  
      RestClient client = new 
      RestClient(url);
      client.Authenticator = new HttpBasicAuthenticator(usr, pwd);
  
      RestRequest request = new RestRequest(url);
      request.Method = Method.POST;
      request.AddFile(Path.GetFileNameWithoutExtension(filePath), filePath);
  
      try
      {
          IRestResponse response = client.Execute(request);
          Console.WriteLine(response.Content);
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex);
      }
      Console.ReadLine();
  </code></pre>
  
  <p>The Authenticator works fine, but when I send the request I get the message:
  <strong>"Required request part 'file' is not present"</strong></p>
  
  <p>How can I add this request? 
  Can I use the json as some template to send my request?</p>