質問編集履歴
2
質問の趣旨をより詳細に説明するために画像を追記
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -194,6 +194,8 @@ | |
| 194 194 | 
             
            }
         | 
| 195 195 | 
             
            ```
         | 
| 196 196 |  | 
| 197 | 
            +
            
         | 
| 198 | 
            +
             | 
| 197 199 | 
             
            ---
         | 
| 198 200 | 
             
            以上、ご確認のほどよろしくお願い申し上げます。
         | 
| 199 201 |  | 
1
質問の内容をより詳しく説明するために細く説明を追記。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -163,6 +163,37 @@ | |
| 163 163 |  | 
| 164 164 | 
             
            401エラーとは、ユーザー名・パスワードなどが間違っておりWebサイトの認証に失敗したときに表示されると思います。ですが.envファイルのkeyとHost名はコピペしたもので、間違いはないことを何度も確認しています。
         | 
| 165 165 |  | 
| 166 | 
            +
            ### 7. 文章を翻訳するときのGETメソッド(2023年7月25日追記)
         | 
| 167 | 
            +
             | 
| 168 | 
            +
            英語の文章を日本語の文章を翻訳するときに叩くAPIのコードスニペットは以下の通りです。
         | 
| 169 | 
            +
             | 
| 170 | 
            +
            コードはRapid API内にある"DeepL Translate Machine"が提示しているものから、"X-RapidAPI-Key"とX-RapidAPI-Hostのプロパティ値を伏せたものです。
         | 
| 171 | 
            +
             | 
| 172 | 
            +
            ```
         | 
| 173 | 
            +
            const axios = require('axios');
         | 
| 174 | 
            +
             | 
| 175 | 
            +
            const options = {
         | 
| 176 | 
            +
              method: 'GET',
         | 
| 177 | 
            +
              url: 'https://deepl-translate-machine.p.rapidapi.com/v1/translate/text',
         | 
| 178 | 
            +
              params: {
         | 
| 179 | 
            +
                target: 'JA',
         | 
| 180 | 
            +
                source: 'EN',
         | 
| 181 | 
            +
                text: 'NASA was established in 1958, succeeding the National Advisory Committee for Aeronautics (NACA), to give the U.S. space development effort a distinctly civilian orientation, emphasizing peaceful applications in space science.'
         | 
| 182 | 
            +
              },
         | 
| 183 | 
            +
              headers: {
         | 
| 184 | 
            +
                'X-RapidAPI-Key': API_KEY,
         | 
| 185 | 
            +
                'X-RapidAPI-Host': HOST_NAME
         | 
| 186 | 
            +
              }
         | 
| 187 | 
            +
            };
         | 
| 188 | 
            +
             | 
| 189 | 
            +
            try {
         | 
| 190 | 
            +
            	const response = await axios.request(options);
         | 
| 191 | 
            +
            	console.log(response.data);
         | 
| 192 | 
            +
            } catch (error) {
         | 
| 193 | 
            +
            	console.error(error);
         | 
| 194 | 
            +
            }
         | 
| 195 | 
            +
            ```
         | 
| 196 | 
            +
             | 
| 166 197 | 
             
            ---
         | 
| 167 198 | 
             
            以上、ご確認のほどよろしくお願い申し上げます。
         | 
| 168 199 |  | 
