ApiVideoError
at new ApiVideoError (/Users/duc.ngoviet/development/spielwiese/tinytales/node_modules/@api.video/nodejs-client/lib/ApiVideoError.js:8:22)
at HttpClient.call (/Users/duc.ngoviet/development/spielwiese/tinytales/node_modules/@api.video/nodejs-client/lib/HttpClient.js:102:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async handler (webpack-internal:///(api)/./pages/api/addVideoEntry.js:48:21)
at async /Users/duc.ngoviet/development/spielwiese/tinytales/node_modules/@sentry/nextjs/cjs/common/wrapApiHandlerWithSentry.js:153:35 {
problemDetails: undefined,
code: 0
}
const httpClient = new HttpClient({
apiKey: "apiKey",
baseUri: "https://sandbox.api.video",
});
it took me a while because on this page API reference · api.video documentation a slash is used in the end of the sandbox url, which does not work! the baseUri needs to be exactly this: https://sandbox.api.video and not this: https://sandbox.api.video/
Thanks for noticing the issue in our documentation! (we fixed it)
The main question is, what token are you referring to?
If we are talking about the Access Token, the client library will generate it automatically (after you pass it the API key). If you are referring to the Upload token, you just need to initialize the client with the API key and then request for the upload token.
Hi, the steps you said by just initializing with the api key is not correct to request the upload token when using your nodejs SDK. It seems to work as I have stated in my example by creating a http client and pass this to your api.video/nodejs-client/lib/api/UploadTokensApi.
Also on the page you provided there is no code example how to retrieve an upload token with your nodejs SDK, but as I said I have a working solution now.
I wouldn’t recommend using the HttpClient directly. In the documentation I’ve provided, you have an example how to use the nodejs API client library, which is the best way to implement your code (let me know if the snippet doesn’t work for you, and we will investigate):
ok I see. This looks much better and the code you provided works, thanks! My IDE suggested this import import UploadTokensApi from "@api.video/nodejs-client/lib/api/UploadTokensApi"; so I thought it is intended… maybe the sdk can be adjusted not to expose it this way.