How to submit Request Payload in Vugen

Hi Team, we are unable to uplaod any file type in our application. It's generated the script with web custom request and BODY generated. 

below the custome request generating. Can some one help me.

web_custom_request("97694", 
        "URL=https://{URL}/otmmapi/v4/jobs/imports/{jpob}", 
        "Method=PUT", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=application/json", 
        "Referer=https://{url}/", 
        "Snapshot=t21.inf", 
        "Mode=HTML", 
/*        "Body=-----------------------------7e227f20391016\r\nContent-Disposition: form-data; name=\"job_name\"\r\n\r\nperf\r\n-----------------------------7e227f20391016\r\nContent-Disposition: form-data; name=\"parent_folder_id\"\r\n\r\nfeaab744ba3806215ebd84db89488617b5fddff0\r\n-----------------------------7e227f20391016\r\nContent-Disposition: form-data; name=\"import_job_id\"\r\n\r\n97694\r\n-----------------------------7e227f20391016\r\nContent-Disposition: form-data; name=\"manifest\"; filename=\""
        "blob\"\r\nContent-Type: application/json; charset=UTF-8\r\n\r\n{\"upload_manifest\":{\"master_files\":[{\"file\":{\"file_name\":\"LD_DAM_Duplicates-Demo-20180501 (1).mp4\",\"file_type\":\"video/mp4\"}}]}}\r\n-----------------------------7e227f20391016\r\nContent-Disposition: form-data; name=\"asset_representation\"; filename=\"blob\"\r\nContent-Type: application/json; charset=UTF-8\r\n\r\n{\"asset_resource\":{\"asset\":{\"metadata\":{\"metadata_element_list\":[{\"id\":\"KFG.FIELD.CREATIVE_AGENCY\""
        ",\"type\":\"com.artesia.metadata.MetadataField\",\"value\":{\"value\":{\"type\":\"string\",\"value\":\"KF\"}}},{\"id\":\"KFG.FIELD.CREATIVE_AGENCY_RESTRICTED\",\"type\":\"com.artesia.metadata.MetadataField\",\"value\":{\"value\":{\"type\":\"string\",\"value\":\"KF\"}}}]},\"metadata_model_id\":\"KFG.MODEL.PRODUCT_MEDIA_ASSET\",\"security_policy_list\":[{\"id\":21}]}}}\r\n-----------------------------7e227f20391016\r\nContent-Disposition: form-data; name=\"file_name\"\r\n\r\n"
        "LD_DAM_Duplicates-Demo-20180501 (1).mp4\r\n-----------------------------7e227f20391016--\r\n", */
        LAST);

Tried below optiona aslo but still not working,

 web_submit_data("97686",
        "Action=https://test.kf.cloud.opentext.com/otmmapi/v4/jobs/imports/{import_job_id}",
        "Method=POST",
    //    "EncType=multipart/form-data",
        "Resource=0",
        "RecContentType=application/json",
        "Referer=https://test.kf.cloud.opentext.com/",
        "Snapshot=t17.inf",
        "Mode=HTML",
        "EncType=multipart/form-data",
         ITEMDATA,
        "Name=job_name", "Value= ", ENDITEM,
        "Name=parent_folder_id","Value=feaab744ba3806215ebd84db89488617b5fddff0",ENDITEM, 
        "Name=import_job_id", "Value={import_job_id}",ENDITEM, 
        "Name=manifest","Value=",ENDITEM,
        "Name=filename", "Value=blob", ENDITEM, 
//        "ContentType= application/json",
//        "filename=bolb","Value=",ENDITEM,
        "Name=asset_representation","Value=",ENDITEM,
        "Name=file_name","Value=3663602001751_06i_fr.jpg",ENDITEM,
//        "ContentType= application/json",    
//        "Filename='blob", "Value= ",ENDITEM,
//        "Name=file_name","Value=C:/Users/machil01/Downloads/3663602001751_06i_fr.jpg",ENDITEM, 
//      "Name=metadata_element_list","Value=KFG.FIELD.CREATIVE_AGENCY,KFG.FIELD.CREATIVE_AGENCY_RESTRICTED",
//        ENDITEM,
        LAST);

 

 

Thanks,

Laxmi

  • Did you check to see if the parentID is not dynamic?

  • Hi,

    Parent id is not dynamic..

    During the recording time Getting this request:

    PUT /otmmapi/v4/jobs/imports/97694 HTTP/1.1
    Accept: application/json; charset=UTF-8
    X-OTMM-Request: true
    X-USES-CHUNKS: false
    X-Requested-By: 2115310489
    Content-Type: multipart/form-data; boundary=---------------------------7e227f20391016
    Referer: https://test.kf.cloud.opentext.com/
    Accept-Language: en-GB
    UA-CPU: AMD64
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko
    Host: test.kf.cloud.opentext.com
    Content-Length: 1427

    -----------------------------7e227f20391016
    Content-Disposition: form-data; name="job_name"

    perf
    -----------------------------7e227f20391016
    Content-Disposition: form-data; name="parent_folder_id"

    feaab744ba3806215ebd84db89488617b5fddff0
    -----------------------------7e227f20391016
    Content-Disposition: form-data; name="import_job_id"

    97694
    -----------------------------7e227f20391016
    Content-Disposition: form-data; name="manifest"; filename="blob"
    Content-Type: application/json; charset=UTF-8

    {"upload_manifest":{"master_files":[{"file":{"file_name":"LD_DAM_Duplicates-Demo-20180501 (1).mp4","file_type":"video/mp4"}}]}}
    -----------------------------7e227f20391016
    Content-Disposition: form-data; name="asset_representation"; filename="blob"
    Content-Type: application/json; charset=UTF-8

    {"asset_resource":{"asset":{"metadata":{"metadata_element_list":[{"id":"KFG.FIELD.CREATIVE_AGENCY","type":"com.artesia.metadata.MetadataField","value":{"value":{"type":"string","value":"KF"}}},{"id":"KFG.FIELD.CREATIVE_AGENCY_RESTRICTED","type":"com.artesia.metadata.MetadataField","value":{"value":{"type":"string","value":"KF"}}}]},"metadata_model_id":"KFG.MODEL.PRODUCT_MEDIA_ASSET","security_policy_list":[{"id":21}]}}}
    -----------------------------7e227f20391016
    Content-Disposition: form-data; name="file_name"

    LD_DAM_Duplicates-Demo-20180501 (1).mp4
    -----------------------------7e227f20391016--

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

    During Replay getting below RAW data:

    POST /otmmapi/v4/jobs/imports/97980 HTTP/1.1
    Content-Type: multipart/form-data; boundary=---------------------------7d025e2b16b064e
    Referer: https://test.kf.cloud.opentext.com/
    UA-CPU: AMD64
    X-OTMM-Request: true
    X-USES-CHUNKS: false
    X-Requested-By: 2104922269
    User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko
    Accept-Encoding: gzip, deflate
    Accept-Language: en-GB
    Accept: */*
    Connection: Keep-Alive
    Host: test.kf.cloud.opentext.com
    Cookie: JSESSIONID=-varoRSQ3z1jB-WizD1qBS7RswA6WBrDKR4o7RYN.otmm01; JSESSIONID=D1EenvccoJtJv31jmlCqac1Nsia-PxLLFHGVttDh.otmm01; BIGipServertest.kf_80=1173334208.20480.0000
    Content-Length: 841

    -----------------------------7d025e2b16b064e
    Content-Disposition: form-data; name="job_name"


    -----------------------------7d025e2b16b064e
    Content-Disposition: form-data; name="parent_folder_id"

    feaab744ba3806215ebd84db89488617b5fddff0
    -----------------------------7d025e2b16b064e
    Content-Disposition: form-data; name="import_job_id"

    97980
    -----------------------------7d025e2b16b064e
    Content-Disposition: form-data; name="manifest"


    -----------------------------7d025e2b16b064e
    Content-Disposition: form-data; name="filename"

    blob
    -----------------------------7d025e2b16b064e
    Content-Disposition: form-data; name="asset_representation"


    -----------------------------7d025e2b16b064e
    Content-Disposition: form-data; name="file_name"

    3663602001751_06i_fr.jpg
    -----------------------------7d025e2b16b064e--

    1. Did you compare with another recording?
    2. I see a difference that in one place it is PUT and another it is POST. PUT method is available through web_custom_request 
  • Hi,

    1. Web custome request generated with PUT mode.

    when I run this request I am getting 400 BAD request. We want to undesrtand the how to format the request " Multipart/form-data". We are trying to upload the JPG file.

    2. I have passed the WEB_SUBMIT_DATA with POST method.

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

    I tried HTM L & URL mode recording , both should generated web_custom_request only.

    Thanks,

    Laxmi

  • Please suggest me, how to resolve the issue.

  • Hi Machineni,

    I am facing exactly same issue and i am unable to find the solution.

    Please let me know if the issue is resolved and how to resolve.

    Thanks in advance.

     

     

  • i am also testing OTMM application, and facing the similar issue.
    Please let me know the sulution, if u have
  • To implement PUT method you should use web_custom_request API. 

    For the original PUT request mentioned in this thread the following step can be applied:

            web_add_header("X-OTMM-Request","true");
            web_add_header("X-USES-CHUNKS","false");
            web_add_header("X-Requested-By","2115310489");
        
            web_custom_request("test",
            "URL=<your URL>", // http://httpbin.org/put",
            "Method=PUT",
            "Resource=0",
            "RecContentType=application/json",
            "Snapshot=t6.inf",
            "Mode=HTML",
            "EncType=multipart/form-data; boundary=-----------------------------7e227f20391016",
            "Body=" 
            "-----------------------------7e227f20391016\r\n"
            "Content-Disposition: form-data; name=\"job_name\"\r\n"
            "\r\n"
            "perf\r\n"
            "-----------------------------7e227f20391016\r\n"
            "Content-Disposition: form-data; name=\"parent_folder_id\"\r\n"
            "\r\n"
            "feaab744ba3806215ebd84db89488617b5fddff0\r\n"
            "-----------------------------7e227f20391016\r\n"
            "Content-Disposition: form-data; name=\"import_job_id\"\r\n"
            "\r\n"
            "97694\r\n"
            "-----------------------------7e227f20391016\r\n"        
            "Content-Disposition: form-data; name=\"manifest\"; filename=\"blob\"\r\n"
            "Content-Type: application/json; charset=UTF-8\r\n"
            "\r\n"
            "{\"upload_manifest\":{\"master_files\":[{\"file\":{\"file_name\":\"LD_DAM_Duplicates-Demo-20180501 (1).mp4\",\"file_type\":\"video/mp4\"}}]}}\r\n"
            "-----------------------------7e227f20391016\r\n"
            "Content-Disposition: form-data; name=\"asset_representation\"; filename=\"blob\"\r\n"
            "Content-Type: application/json; charset=UTF-8\r\n"
            "\r\n"
            "{\"asset_resource\":{\"asset\":{\"metadata\":{\"metadata_element_list\":[{\"id\":\"KFG.FIELD.CREATIVE_AGENCY\",\"type\":\"com.artesia.metadata.MetadataField\",\"value\":{\"value\":{\"type\":\"string\",\"value\":\"KF\"}}},{\"id\":\"KFG.FIELD.CREATIVE_AGENCY_RESTRICTED\",\"type\":\"com.artesia.metadata.MetadataField\",\"value\":{\"value\":{\"type\":\"string\",\"value\":\"KF\"}}}]},\"metadata_model_id\":\"KFG.MODEL.PRODUCT_MEDIA_ASSET\",\"security_policy_list\":[{\"id\":21}]}}}\r\n"
            "-----------------------------7e227f20391016\r\n"
            "Content-Disposition: form-data; name=\"file_name\"\r\n"
            "\r\n"
            "LD_DAM_Duplicates-Demo-20180501 (1).mp4\r\n"
            "-----------------------------7e227f20391016--\r\n",
            LAST);

    In many cases missed Request headers will cause HTTP 400 Bad Request  response, so it always important to supply request headers set as it was in recording.

    When you use POST method for file uploading, web_submit_data API is more suitable. In such step you can control all the required parameters.

    In example below we upload file globals.h from script folder:

        web_submit_data("test", 
            "Action=<your URL>", //http://httpbin.org/post", 
            "Method=POST", 
            "EncType=multipart/form-data", 
            "TargetFrame=", 
            "RecContentType=application/json", 
            "Snapshot=t2.inf", 
            "Mode=HTML", 
            ITEMDATA, 
                "Name=name_of_files",            // form field name 
                "Value=my-file",                 // value in Content-Disposition parameter of multipart message
                "File=Yes", 
                "ContentType=text/special",        // value in Content-Type parameter of multipart message
                "FilePath=globals.h",            // source path of upoaded file
                "ContentTransferEncoding=free",    // value in Content-Transfer-Encoding parameter of multipart message
            ENDITEM, 
            LAST);

    Best regards,

    Leonid

     

     

  • Thanks for the quick response.

    I have tried the proposed solution, however getting 400- bad request error.

    Compared all the request header values and request body values, all values are passing correctly and same as recorded values(except dynamic values"X-requested-by").

     

    Thanks,

    Jagadeeswara 

  • The value of the header might need be correlated. So search in an earlier response for the same value (it might be part of returned java script). So make a parameter of it by using on of the web_reg_save_param* functions.