Hello everyone,
I try to add attachment to request. As you can see on attachment i can upload from PostMan. I made a simple form for upload attachment to request but it gave an error like below.
- {"response_status":{"messages":[{"type":"failed","message":"The value given for the [request] fields is invalid","status_code":"4001"}],"status":"failed"}}
I guess input name is wrong but i couldn't figure it out.
- <form id="form" name="form" method="post" enctype="multipart/form-data" action="javascript:void(0);">
- <input id="file" name="file" type="file" />
- <button class="upload">Upload</button>
- </form>
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
- <script>
- $(document).ready(function() {
- $(document).on("click", ".upload", function()
- {
- $.ajax({
- type:"POST",
- url:"http://10.10.10.10:8080/api/v3/attachments?input_data=%7B%22attachment%22%3A%7B%22request%22%3A%7B%22id%22%3A%2228185%22%7D%7D%7D&TECHNICIAN_KEY=xxxxx",
- dataType:"text",
- cache: false,
- contentType: false,
- mimeType: "multipart/form-data",
- processData: false,
- data:$("#form").serialize(),
- })
- .done(function(response) {
- alert(response);
- });
- return false;
- });
- });
- </script>