Open sneljo1 opened 3 years ago
This is a good one. Adding this to backlog.
Until the official OpenAPI spec becomes available I've found the following workaround:
import { promises as fs } from 'node:fs'
import puppeteer from 'puppeteer'
// NOTE the spec can be validated here https://apitools.dev/swagger-parser/online/
const main = async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://developers.soundcloud.com/docs/api/explorer/open-api')
// get spec from swagger
const specStr = await page.evaluate(() => window.ui.spec()._root.entries[0][1])
const spec = JSON.parse(specStr.replaceAll('; charset=utf-8', ''))
await fs.writeFile('openapi.json', JSON.stringify(spec, null, 2))
await browser.close()
}
main().catch((e) => console.error(e))
openapi.json
Just gave the openapi.json
you posted a try. It can't be validated.
+1
You can manually extract it from https://developers.soundcloud.com/docs/api/explorer/swagger-ui-init.js
Everything inside var options = { "swaggerDoc": {
is an openapi.json
.
@rahul-sc are there plans to offer official SDKs (client libraries) for the Soundcloud API?
Title: Expose the raw swagger.json definition file for the Public API
Issue found of: Januari 21th, 2021
Is the raw json file for the open-api definition hosted somewhere? Usually it is possible to find or access it, but I cannot find it. I would like to access this in order to generated types from it.
However, I also noticed not all responses seem to have a proper schema, only examples. Is this something your are planning to maintain?