← Integrations
Swift
Code exampleThere is no SDK for Swift and none is needed: one HTTP request with a key in the header, a template name and your fields. The example below is the whole integration.
How to set it up
- 01Create a key in the dashboard under Keys and keep it out of your source.
- 02Send the request below; the answer holds the job id and its status.
- 03Want to know the paper moved? Poll /v1/jobs/{id}, or take an outgoing webhook.
The request
var verzoek = URLRequest(url: URL(string: "https://instntprint.com/v1/jobs")!)
verzoek.httpMethod = "POST"
verzoek.setValue("application/json", forHTTPHeaderField: "Content-Type")
verzoek.setValue("Bearer \(sleutel)", forHTTPHeaderField: "Authorization")
verzoek.httpBody = try JSONSerialization.data(withJSONObject: [
"printer": "Balie", "template": "Kassabon",
"data": ["totaal": "3.80", "betaalwijze": "Pin"],
])
let (data, _) = try await URLSession.shared.data(for: verzoek)