diff --git a/api/index.md b/api/index.md index feddcaa..3ddb388 100644 --- a/api/index.md +++ b/api/index.md @@ -11,6 +11,7 @@ Unofficial documentation for the Scratch API. See [root index](..) for more info * [`/proxy` API](proxy.md) - Miscellaneous utilities * [`/users` API](users.md) - Fetch user information * [`projects.` and `assets.` APIs](project_data.md) - Fetch code and assets used in projects +* [`synthesis-service.` and `translation-service.` APIs](synth_trans.md) - Fetch translations and syntheses used by block extensions ### Object definitions diff --git a/api/project_data.md b/api/project_data.md index cbaad87..c3c605d 100644 --- a/api/project_data.md +++ b/api/project_data.md @@ -2,11 +2,15 @@ These retrieve all of the data and files needed for a scratch project/file. -### `GET cdn.projects.scratch.mit.edu//` +## `https://cdn.projects.scratch.mit.edu/` + +### `GET //` Retrieves the projects JSON data, which is where all of the code for a scratch project is stored. -### `GET cdn.assets.scratch.mit.edu/internalapi/asset//get/` +## `https://cdn.assets.scratch.mit.edu/` + +### `GET /internalapi/asset//get/` Retrieves the asset with the given file name. An asset is a costume, sound or other file used in a project. Each asset in each project has a unique md5 id, which is used for referencing and retrieving it. diff --git a/api/synth_trans.md b/api/synth_trans.md new file mode 100644 index 0000000..b1ea119 --- /dev/null +++ b/api/synth_trans.md @@ -0,0 +1,25 @@ +# `synthesis-service.` and `translate-service.` APIs + +These retrieve the speech synthesis and translation results for their respective extensions. + +## `https://translate-service.scratch.mit.edu/` + +### `GET /translate?language=&text=` + +Retrieves the translation of the input text in the given language. `locale` is generally a two-letter language code. Refer to [this gist](https://gist.github.com/towerofnix/d4369e64604c5a0d7dca94954a83ab35) for a list of supported languages, or check the exports from [`scratch-translate-extension-languages`](https://www.npmjs.com/package/scratch-translate-extension-languages). + +Uses Google Translate [as of Dec. 9, 2019](https://scratch.mit.edu/discuss/post/3778811). + +### `GET https://translate-service.scratch.mit.edu/supported` + +Retrieves a list of supported language codes for translating text. + +Legacy endpoint - still online, but [no longer used](https://github.com/scratchfoundation/scratch-vm/pull/1159). + +## `https://synthesis-service.scratch.mit.edu/` + +### `GET /synth?locale=&gender=&text=` + +Retrieves the synthesis of the input text as an audio file. `gender` is either "male" or "female"; `speech locale` is a "speech synth locale" as described in [the extension's source code](https://github.com/scratchfoundation/scratch-vm/blob/489111f4d74909c2adac40ade1618f966ba30c34/src/extensions/scratch3_text2speech/index.js#L194-L341). + +Likely uses [Amazon Polly](https://aws.amazon.com/polly/).