Quickstart
You will create a key, look up the service to file against, open a request and read it back.
-
Create an API key. In the Duty portal go to Integrations → Keys and webhooks and select Create key. Turn on Write access so the key can open requests. Copy the key: it starts with
gm_sd_and is shown only once.Keep it in an environment variable rather than in your code:
Terminal window export DUTY_API_KEY="gm_sd_…" -
Find the service. Every request belongs to a service of your catalog. List them and note the
idof the one to use:Terminal window curl https://api.client.service-desk.goldmaster.io/v1/services \-H "Authorization: Bearer $DUTY_API_KEY"{"data": [{ "id": 12, "name": "VPN and remote access", "description": "Connection problems and access requests", "defaultPriority": "medium", "requiresApproval": false }]} -
Open the request. Send the service, a subject, a description and who the request is for:
Terminal window curl https://api.client.service-desk.goldmaster.io/v1/tickets \-H "Authorization: Bearer $DUTY_API_KEY" \-H "Content-Type: application/json" \-d '{"serviceId": 12,"subject": "VPN disconnects every few minutes","description": "Since this morning the VPN drops every 5 to 10 minutes.","contact": { "name": "Ana Pérez", "email": "ana.perez@example.com" }}'const response = await fetch('https://api.client.service-desk.goldmaster.io/v1/tickets', {method: 'POST',headers: {Authorization: `Bearer ${process.env.DUTY_API_KEY}`,'Content-Type': 'application/json',},body: JSON.stringify({serviceId: 12,subject: 'VPN disconnects every few minutes',description: 'Since this morning the VPN drops every 5 to 10 minutes.',contact: { name: 'Ana Pérez', email: 'ana.perez@example.com' },}),});const { data: request } = await response.json();console.log(request.number); // GM-000123import osimport requestsresponse = requests.post("https://api.client.service-desk.goldmaster.io/v1/tickets",headers={"Authorization": f"Bearer {os.environ['DUTY_API_KEY']}"},json={"serviceId": 12,"subject": "VPN disconnects every few minutes","description": "Since this morning the VPN drops every 5 to 10 minutes.","contact": {"name": "Ana Pérez", "email": "ana.perez@example.com"},},timeout=30,)response.raise_for_status()print(response.json()["data"]["number"]) # GM-000123The API answers
201 Createdwith the full request. Itsnumber(such asGM-000123) identifies it from now on, andresponseDueAtandresolutionDueAtalready carry the targets of your service level agreement. -
Read it back. Get the request with its current status and the transitions it can make next:
Terminal window curl https://api.client.service-desk.goldmaster.io/v1/tickets/GM-000123 \-H "Authorization: Bearer $DUTY_API_KEY"
What’s next
Section titled “What’s next”- Keep your system in step with webhooks instead of polling.
- Sync existing requests with
updatedSince. - Learn the error format so your integration can explain what went wrong.