code: public function uploadSnippet($version, array $snippet)
      {
          // Perform replacements vcl template replacements
          if (isset($snippet['content'])) {
              $adminUrl = $this->vcl->getAdminFrontName();
              $adminPathTimeout = $this->config->getAdminPathTimeout();
              $ignoredUrlParameters = $this->config->getIgnoredUrlParameters();
  
              $ignoredUrlParameterPieces = explode(",", $ignoredUrlParameters);
              $filterIgnoredUrlParameterPieces = array_filter(array_map('trim', $ignoredUrlParameterPieces));
              $queryParameters = implode('|', $filterIgnoredUrlParameterPieces);
  
              $snippet['content'] = str_replace('####ADMIN_PATH####', $adminUrl, $snippet['content']);
              $snippet['content'] = str_replace('####ADMIN_PATH_TIMEOUT####', $adminPathTimeout, $snippet['content']);
              $snippet['content'] = str_replace('####QUERY_PARAMETERS####', $queryParameters, $snippet['content']);
          }
  
          $checkIfExists = $this->hasSnippet($version, $snippet['name']);
          $url = $this->_getApiServiceUri(). 'version/' .$version. '/snippet';
          if (!$checkIfExists) {
              $verb = \Zend_Http_Client::POST;
          } else {
              $verb = \Zend_Http_Client::PUT;
              $url .= '/'.$snippet['name'];
              unset($snippet['name'], $snippet['type'], $snippet['dynamic'], $snippet['priority']);
          }
  
          $result = $this->_fetch($url, $verb, $snippet);
  
          if (!$result) {
              throw new LocalizedException(__('Failed to upload the Snippet file.'));
          }
      }
docs: Creating and updating regular VCL snippets
  
  @param $version
  @param array $snippet
  @throws LocalizedException
  @throws \Exception
  @throws \Magento\Framework\Exception\FileSystemException