Authoring

Shared framework reference

Upload local files

Use create_upload for a local file that is too large to pass inline: a source file, artwork, a sound, or a cover or logo. It works the same in every framework major.

  1. Compute the file's SHA-256 and byte length from the file you will upload:

    shasum -a 256 AbyssalPredator.png
    wc -c < AbyssalPredator.png
    
  2. Call create_upload with the game's gameDefinitionId, the sha256, the byteLength and a target, such as { type: "art", key: "AbyssalPredator" }.

  3. POST the unchanged file to the returned uploadUrl:

    curl --data-binary @AbyssalPredator.png \
      -H 'Content-Type: application/octet-stream' "$UPLOAD_URL"
    
  4. Read the answer as you read upload_art's: check isError, then read content[0].text.

Request one URL for each file. Keep the URL out of logs: it authorizes the upload by itself. create_upload's description lists the other targets, the limits, the expiry and when to request a new URL.

Need a hand with this?

Join our Discord