@@ -68,6 +68,63 @@ EditApi.getRender(renderId, { data: false }).then((data) => {
6868});
6969```
7070
71+ #### Ingest API
72+
73+ Ingest a video and create a rendition:
74+
75+ ``` javascript
76+ import Shotstack , { IngestApiApiKeys } from ' ./dist/index.js' ;
77+
78+ const apiKey = ' YOUR_API_KEY' ;
79+ const basePath = ' https://api.shotstack.io/ingest/v1' ;
80+
81+ const IngestApi = new Shotstack.IngestApi (basePath);
82+ IngestApi .setApiKey (IngestApiApiKeys .DeveloperKey , apiKey);
83+
84+ const size = new Shotstack.Size ();
85+ size .width = 1280 ;
86+ size .height = 720 ;
87+
88+ const rendition = new Shotstack.Rendition ();
89+ rendition .format = Shotstack .Rendition .FormatEnum .MP4 ;
90+ rendition .size = size;
91+
92+ const outputs = new Shotstack.Outputs ();
93+ outputs .renditions = [rendition];
94+
95+ const source = new Shotstack.Source ();
96+ source .url = ' https://github.com/shotstack/test-media/raw/main/captioning/scott-ko.mp4' ;
97+ source .outputs = outputs;
98+
99+ IngestApi .postSource (source).then ((data ) => {
100+ console .log (data .response .body );
101+ });
102+ ```
103+
104+ Get source and rendition details:
105+
106+ ``` javascript
107+ import Shotstack , { IngestApiApiKeys } from ' ./dist/index.js' ;
108+
109+ const apiKey = ' YOUR_API_KEY' ;
110+ const basePath = ' https://api.shotstack.io/ingest/v1' ;
111+
112+ const IngestApi = new Shotstack.IngestApi (basePath);
113+ IngestApi .setApiKey (IngestApiApiKeys .DeveloperKey , apiKey);
114+
115+ const sourceId = ' zzy89yhy-1w4y-xe41-t3v6-1gafvp0qmhvz' ;
116+
117+ IngestApi .getSource (sourceId).then ((data ) => {
118+ if (data .response .body .data .attributes .status === ' ready' ) {
119+ console .log (' Source:' , data .response .body .data .attributes .source );
120+
121+ if (data .response .body .data .attributes .outputs .renditions [0 ].status === ' ready' ) {
122+ console .log (' Rendition:' , data .response .body .data .attributes .outputs .renditions [0 ].url );
123+ }
124+ }
125+ });
126+ ```
127+
71128#### Create API
72129
73130Generate an image using Shotstack text-to-image service
0 commit comments