»Ë»Ñ Æ÷·³
IT °³¹ßÀÚ°£ Á¤º¸¸¦ °øÀ¯ÇÏ°í ³íÀÇ°¡ ÀÌ·ç¾îÁö´Â °ø°£ÀÔ´Ï´Ù.

api ¼­¹ö¿¡ post ¿äû½Ã ¿¡·¯ Áú¹®7

  • [* ºñȸ¿ø *]
  • µî·ÏÀÏ 2023-03-06 17:22
  • Á¶È¸¼ö 1532
api ¼­¹ö¿¡ post ¿äûÇÏ´Â ³»¿ëÀ» html ·Î °£´ÜÇÏ°Ô ÀÛ¼ºÇߴµ¥¿ä..

 

2°¡Áö ¹æ¹ýÀ¸·Î ¿äûÇßÀ¸³ª 

 

 {"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13","title":"Unsupported Media Type","status":415,"traceId":"00-41808cde0d4cf94c3c84e9d91e960223-076264ce7f4ffcdb-00"}

 

À§¿Í °°Àº ¿¡·¯ ¸Þ½ÃÁö°¡ ¶ß¸é¼­ ¾ÈµË´Ï´Ù. Á¦°¡ ¾Ë±â·Ð 415 ¿¡·¯°¡ json Çü½ÄÀ¸·Î µ¥ÀÌÅ͸¦ ³Ñ±âÁö ¾Ê¾Æ¼­ ±×·±°É·Î ¾Ë°í Àִµ¥¿ä.

 

html ·Î post ¿äûÀ» ÀÛ¼ºÇÒ ¶§ content typeÀ» json À¸·Î Çصµ ¾ÈµÇ³×¿ä,, (swagger ·Î json µ¥ÀÌÅÍ Æ÷ÇÔÇؼ­ post ¿äûÇϰųª, postman ÇÁ·Î±×·¥À» ÅëÇØ json µ¥ÀÌÅÍ Æ÷ÇÔÇؼ­ post ¿äûÇϸé Àß µË´Ï´Ù,..)

 

 

¾Æ·¡ html ÄÚµå´Â Á¦°¡ ÇØ º» °Í ÀÔ´Ï´Ù,, ¹«¾ùÀÌ ¹®Á¦ Àϱî¿ä?

 

 

==========================

ù¹ø° html

===================

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>JSON ÆÄÀÏ ¼±ÅÃÇϱâ</title> </head> <body> <form method="post" action="http://192.168.0.69:8080/api/withdraw" enctype="application/json"> <input type="file" name="json_file" accept=".json"> <button type="submit">Àü¼Û</button> </form> </body> </html>

 

====================

µÎ¹ø° html

=-===================

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>JSON ÆÄÀÏ ¼±ÅÃÇϱâ</title> </head> <body> <form method="post" action="http://192.168.0.69:8080/api/withdraw" enctype="application/json"> <input type="file" name="json_file" accept=".json" onchange="loadFile(event)"> <button type="submit" onclick="sendJson()">Àü¼Û</button> </form> <script> function loadFile(event) { const input = event.target; if ('files' in input && input.files.length > 0) { readJSON(input.files[0]); } } function readJSON(file) { const reader = new FileReader(); reader.onload = function(event) { const contents = event.target.result; const jsonData = JSON.parse(contents); document.getElementById("json_data").value = JSON.stringify(jsonData); }; reader.readAsText(file); } function sendJson() { const jsonData = document.getElementById("json_data").value; const xhr = new XMLHttpRequest(); xhr.open("POST", "http://192.168.0.69:8080/api/withdraw"); xhr.setRequestHeader("Content-Type", "application/json"); xhr.send(jsonData); } </script> <textarea id="json_data" style="display:none;"></textarea> </body> </html>

 

0
ÃßõÇϱ⠴ٸ¥ÀÇ°ß 0
ºÏ¸¶Å©¹öÆ° °øÀ¯¹öÆ°

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 notebook
2023-03-06 Á¡¾ÆÀÌÄÜ
  1. ´ñ±ÛÁÖ¼Òº¹»ç

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 [* ºñȸ¿ø *]
2023-03-07 Á¡¾ÆÀÌÄÜ
  1. ´ñ±ÛÁÖ¼Òº¹»ç

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ÁöÁî
2023-03-07 Á¡¾ÆÀÌÄÜ
  1. ´ñ±ÛÁÖ¼Òº¹»ç

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 [* ºñȸ¿ø *]
2023-03-07 Á¡¾ÆÀÌÄÜ
  1. ´ñ±ÛÁÖ¼Òº¹»ç

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ¾ÊÀ̾ÊÀÌ
2023-03-08 Á¡¾ÆÀÌÄÜ
  1. ´ñ±ÛÁÖ¼Òº¹»ç

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ÇÑ´Üz
2023-03-08 Á¡¾ÆÀÌÄÜ
  1. ´ñ±ÛÁÖ¼Òº¹»ç

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ÇÑ´Üz
2023-03-08 Á¡¾ÆÀÌÄÜ
  1. ´ñ±ÛÁÖ¼Òº¹»ç
  • ¾Ë¸² ¿å¼³, »óó ÁÙ ¼ö ÀÖ´Â ¾ÇÇÃÀº »ï°¡ÁÖ¼¼¿ä.
©¹æ »çÁø  
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û -¸ñ·Ïº¸±â