How to Check Multiple Text Inputs for SQL Injection Attacks in Swift

import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)let parameters = "{\n \"RequestItems\": [\n {\n \"InputText\": \"<string>\"\n },\n {\n \"InputText\": \"<string>\"\n }\n ],\n \"DetectionLevel\": \"<string>\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.cloudmersive.com/validate/text-input/check/sql-injection/batch")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("YOUR-API-KEY-HERE", forHTTPHeaderField: "Apikey")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"RequestItems": [
{
"InputText": "string"
}
],
"DetectionLevel": "string"
}

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Announcement: Patch 1.0.2 notes

Advanced Localization Technique for Enums in iOS development

Creational Design Pattern — Prototype in iOS-Swift

Swift. Static and Dynamic Libraries. Frameworks

Managing Source Of Truth in SwiftUI

Push Notification with Elixir and iOS

Escape Games: Logic Puzzles is a Fun iOS Puzzle Game to Test You IQ & Train Your Brain

Dynamically Hide Views in SwiftUI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Keycloak Admin REST API

Automate iOS App testing with Continuous Integration service

How to Scan a File for Viruses in Java: Advanced Scan Edition

Spring Core RCE or Spring4Shell