# Code Samples Use the code samples below to integrate your applications with the API. ## Node ### Submit JSON data for sentiment analysis This example uses the [Axios HTTP client](https://axios-http.com/). The following example demonstrates how to submit a JSON transcript for sentiment analysis using the Axios HTTP client. To use this example, set the `` placeholder to your Rev AI account's access token. ```javascript const axios = require('axios'); const token = ''; // create a client const http = axios.create({ baseURL: 'https://api.rev.ai/sentiment_analysis/v1/', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }); // submit a POST request const submitSentimentAnalysisJobJson = async (jsonData) => { return await http.post(`jobs`, JSON.stringify({ json: jsonData })) .then(response => response.data) .catch(console.error); }; ``` ### Submit plaintext data for sentiment analysis This example uses the [Axios HTTP client](https://axios-http.com/). The following example demonstrates how to submit a plaintext transcript for sentiment analysis using the Axios HTTP client. To use this example, set the `` placeholder to your Rev AI account's access token. ```javascript const axios = require('axios'); const token = ''; // create a client const http = axios.create({ baseURL: 'https://api.rev.ai/sentiment_analysis/v1/', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }); // submit a POST request const submitSentimentAnalysisJobText = async (textData) => { return await http.post(`jobs`, JSON.stringify({ text: textData })) .then(response => response.data) .catch(console.error); }; ``` ### Check the status of a sentiment analysis job This example uses the [Axios HTTP client](https://axios-http.com/). The following example demonstrates how to retrieve the status of a sentiment analysis job using the Axios HTTP client. To use this example, set the `` placeholder to your Rev AI account's access token. ```javascript const axios = require('axios'); const token = ''; // create a client const http = axios.create({ baseURL: 'https://api.rev.ai/sentiment_analysis/v1/', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }); // submit a GET request const getSentimentAnalysisJobStatus = async (jobId) => { return await http.get(`jobs/${jobId}`) .then(response => response.data) .catch(console.error); }; ``` ### Retrieve a sentiment analysis report This example uses the [Axios HTTP client](https://axios-http.com/). The following example demonstrates how to retrieve the result of a sentiment analysis job using the Axios HTTP client. To use this example, set the `` placeholder to your Rev AI account's access token. ```javascript const axios = require('axios'); const token = ''; // create a client const http = axios.create({ baseURL: 'https://api.rev.ai/sentiment_analysis/v1/', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }); // submit a GET request const getSentimentAnalysisJobResult = async (jobId) => { return await http.get(`jobs/${jobId}/result`, { headers: { 'Accept': 'application/vnd.rev.sentiment.v1.0+json' } }) .then(response => response.data) .catch(console.error); }; ```