Content Management#

The primary focus of Smithed is providing a place to distribute content. The API has a few ways to manage this content via HTTP requests.

Retrieve a user's pack data#

No authentication needed

Returns the JSON structure for a user's pack.

Directory Information

In order to retrieve the directory information you must use another endpoint

Parameters

Query parameters

You only need to specify UID or Username, one must be specified

uid
The UID of the user whose pack you are trying to retrieve

username
The username of the user whose pack you are trying to retrieve

pack
The ID of the pack you're trying to retrieve

Code Samples

GET /getUserPack
const url = `https://api.smithed.dev/getUserPack?username=smithed&pack=actionbar`
const resp = await fetch(url)

Response

200 OK
{
  "categories": [
    "Library"
  ],
  "display": {
    "description": "Compatible actionbars for all!",
    "hidden": false,
    "icon": "...",
    "name": "[SMD] Actionbar",
    "webPage": "..."
  },
  "id": "actionbar",
  "versions": [
    {
      "breaking": true,
      "downloads": {
        "datapack": "..."
      },
      "name": "0.1.0",
      "supports": [
        "1.19"
      ]
    }
  ]
}

Retrieve data for all of a user's packs#

No authentication needed

Returns the JSON structure for all of a user's packs

Parameters

Query parameters

You only need to specify UID or Username, one must be specified

uid
The UID of the user whose pack you are trying to retrieve

username
The username of the user whose pack you are trying to retrieve

Code Samples

GET /getUserPacks
const url = `https://api.smithed.dev/getUserPacks?username=smithed`
const resp = await fetch(url)

Response

200 OK
[
  {
    "display": {
      // Minimized
    },
    "id": "prevent-aggression",
    "versions": [
      {
        "name": "0.1.0",
        // Minimized
      }
    ]
  },
  // Truncated List
]

Set the data for a user's pack#

Authentication required

Set the JSON structure for a user's pack.

Parameters

Query parameters

You only need to specify UID or Username, one must be specified

token
Either your user IDToken or a PAT

uid
The UID of the user whose pack you are trying to retrieve

username
The username of the user whose pack you are trying to retrieve

pack
The ID of the pack you're trying to retrieve


Body parameters

data Pack
The UID of the user whose pack you are trying to retrieve

Code Samples

POST /setUserPack
const token = '...'
const query = `username=smithed&pack=actionbar&token=${token}`
const body = {
  data: {
    categories: [
      "Library"
    ],
    display: {
      description: "Compatible actionbars for all!",
      hidden: false,
      icon: "...",
      name: "[SMD] Actionbar",
      webPage: "..."
    },
    id: "actionbar",
    versions: [
      {
        breaking: true,
        downloads: {
          datapack: "..."
        },
        name: "0.1.0",
        supports: [
          "1.19"
        ]
      }
    ]
  }
}

const resp = await fetch('https://api.smithed.dev/setUserPack?' + query, {
  method: 'POST', 
  headers:{"Content-Type": "application/json"}, 
  body: JSON.stringify(body)
})

Response

200 OK

Delete a user's pack#

Authentication required

Set the JSON structure for a user's pack.

Parameters

Query parameters

You only need to specify UID or Username, one must be specified

token
Either your user IDToken or a PAT

uid
The UID of the user whose pack you are trying to retrieve

username
The username of the user whose pack you are trying to retrieve

pack
The ID of the pack you're trying to retrieve

Code Samples

POST /deleteUserPack
const token = '...'
const query = `username=smithed&pack=actionbar&token=${token}`

const resp = await fetch('https://api.smithed.dev/deleteUserPack?' + query, {
  method: 'POST', 
})

Response

200 OK

Add a pack to a user#

Authentication required

Set the JSON structure for a user's pack.

Parameters

Query parameters

You only need to specify UID or Username, one must be specified

token
Either your user IDToken or a PAT

uid
The UID of the user whose pack you are trying to retrieve

username
The username of the user whose pack you are trying to retrieve

pack
The ID of the pack you're trying to retrieve


Body parameters

data Pack
The UID of the user whose pack you are trying to retrieve

Code Samples

POST /addUserPack
const token = '...'
const query = `username=smithed&pack=actionbar&token=${token}`
const body = {
  data: {
    categories: [
      "Library"
    ],
    display: {
      description: "Compatible actionbars for all!",
      hidden: false,
      icon: "...",
      name: "[SMD] Actionbar",
      webPage: "..."
    },
    id: "actionbar",
    versions: [
      {
        breaking: true,
        downloads: {
          datapack: "..."
        },
        name: "0.1.0",
        supports: [
          "1.19"
        ]
      }
    ]
  }
}

const resp = await fetch('https://api.smithed.dev/addUserPack?' + query, {
  method: 'POST', 
  headers:{"Content-Type": "application/json"}, 
  body: JSON.stringify(body)
})

Response

200 OK