Skip to content

Commit

Permalink
docs: modernize page for get ticket by id (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland authored Feb 25, 2024
1 parent 1245e70 commit 8dd9f92
Showing 1 changed file with 70 additions and 14 deletions.
84 changes: 70 additions & 14 deletions docs/v1/tickets/get-ticket-by-id.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,55 @@
<script setup>
import SampleRequest from '../../components/SampleRequest.vue';
</script>

# Get Ticket by ID

A call to `getTicketData()` in this manner will retrieve ticket metadata information about a single achievement ticket, targeted by its ticket ID.
A call to `API_GetTicketData` in this manner will retrieve ticket metadata information about a single achievement ticket, targeted by its ticket ID.

[[toc]]

## HTTP Request

<SampleRequest httpVerb="GET">https://retroachievements.org/API/API_GetTicketData?i=12345</SampleRequest>

### Query Parameters

| Name | Required? | Description |
| :--- | :-------- | :-------------------- |
| `z` | Yes | Your username. |
| `y` | Yes | Your web API key. |
| `i` | Yes | The target ticket ID. |

## Client Library

::: code-group

```ts [NodeJS]
import { buildAuthorization, getUserSummary } from "@retroachievements/api";

## Examples
// First, build your authorization object.
const userName = "<your username on RA>";
const webApiKey = "<your web API key>";

```ts
import { getTicketData } from "@retroachievements/api";
const authorization = buildAuthorization({ userName, webApiKey });

const ticketData = await getTicketData(authorization, { ticketId: 12345 });
// Then, make the API call.
const ticket = await getTicketData(authorization, { ticketId: 12345 });
```

## Returns
:::

```json
## Response

::: code-group

```json [HTTP Response]
{
"id": 12345,
"achievementId": 11843,
"achievementTitle": "A good Beginning 2",
"achievementDesc": "Your Partner Pokemon reaches Level 10.",
"achievementType": null,
"points": 3,
"badgeName": "309094",
"achievementAuthor": "tuteur51",
Expand All @@ -39,14 +71,38 @@ const ticketData = await getTicketData(authorization, { ticketId: 12345 });
}
```

## Parameters
```json [NodeJS]
{
"id": 12345,
"achievementId": 11843,
"achievementTitle": "A good Beginning 2",
"achievementDesc": "Your Partner Pokemon reaches Level 10.",
"points": 3,
"badgeName": "309094",
"achievementAuthor": "tuteur51",
"gameId": 2816,
"consoleName": "Game Boy Advance",
"gameTitle": "Pokemon Mystery Dungeon: Red Rescue Team",
"gameIcon": "/Images/050264.png",
"reportedAt": "2018-04-11 08:15:55",
"reportType": 1,
"reportState": 2,
"hardcore": null,
"reportNotes": "Right before going to Thunderwave Cave, all three of these triggered at the same time.<br/>MD5: 9837da1fdfe900c52f2109d9718d4e85",
"reportedBy": "ThatOneEnderMan",
"resolvedAt": "2018-04-16 08:03:31",
"resolvedBy": "tuteur51",
"reportStateDescription": "Resolved",
"reportTypeDescription": "Triggered at the wrong time",
"url": "https://retroachievements.org/ticketmanager.php?i=12345"
}
```

| Name | Type | Description |
| :-------------- | :------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------- |
| `authorization` | [`AuthObject`](/v1/data-models/auth-object) | An object that must contain a `userName` and a `webApiKey`. See [this page](/getting-started) for how to create this object. |
| `ticketId` | `string` or `number` | The unique ticket ID. If you are unsure, open the ticket's page on the RetroAchievements.org website and copy the number at the end of the URL. |
:::

## Source

[@retroachievements/api, getTicketData.ts](https://github.dev/RetroAchievements/api-js/blob/main/src/ticket/getTicketData.ts)
[RAWeb, API_GetTicketData.php](https://github.dev/RetroAchievements/RAWeb/blob/master/public/API/API_GetTicketData.php)
| Repo | URL |
| :----------------------- | :-------------------------------------------------------------------------------------- |
| RetroAchievements/RAWeb | https://github.com/RetroAchievements/RAWeb/blob/master/public/API/API_GetTicketData.php |
| RetroAchievements/api-js | https://github.com/RetroAchievements/api-js/blob/main/src/ticket/getTicketData.ts |

0 comments on commit 8dd9f92

Please sign in to comment.