protected override void Execute(CodeActivityContext context) { var projectID = ProjectID.Get(context); var modelID = ModelID.Get(context); var locationID = LocationID.Get(context); var bearerToken = BearerToken.Get(context); var content = Content.Get(context); var jsonData = String.Format("{ \"payload\": { \"textSnippet\": { \"content\": \"{0}\", \"mime_type\": \"text/plain\" } } }", content); var jsonDataBytes = Encoding.ASCII.GetBytes(jsonData); request = HttpWebRequest.CreateHttp(String.Format("https://automl.googleapis.com/v1/projects/{0}/locations/{1}/models/{2}:predict", projectID, locationID, modelID)); request.Method = "POST"; request.ContentType = "application/json"; request.Headers.Add(HttpRequestHeader.Authorization, $"Bearer {bearerToken}"); using (var req_stream = request.GetRequestStream()) { req_stream.Write(jsonDataBytes, 0, jsonDataBytes.Length); req_stream.Close(); } var response = request.GetResponse(); }