i need your support please , i am trying to write test case for api request in a data-driven style as below details
data file is .csv
request body :  form data where keys ( entity , content )
entity key is atext and content is a file
header contain user token
below postman screen shot
the error a post request body but i can’t figure out how to fix
Code snippet
*** Settings ***
Library    RequestsLibrary
Library    JSONLibrary
Library    Collections
Library    OperatingSystem
Library    CSVLibrary
Library    String
Library    DateTime
Resource ./Environment.resource
*** Keywords ***
Login
[Arguments]      ${filePath}
Create Session  APP_Login  ${Serverurl}
${jsonBody}=    Load Json From File    ${EXECDIR}${filePath}
Set To Dictionary    ${jsonBody}   username=${Username}   password=${Password}   app=${Entity}
${response}=    POST On Session    APP_Login    ${Login}    json=${jsonBody}
#    Log To Console  ${response.content}
${token}=    Set Variable    ${response.json() [‘rs’]}
set Suite variable    ${token}
${app-auth-header}=    Create Dictionary   app-auth-header=${token}
Create Session    app_User   ${Serverurl}    headers=${app-auth-header}
##### assertions #####
Should Be Equal As Strings    ${response.status_code}    200
################# Incoming ################
IN Entity
[Arguments]    ${row}
${entity}=    Create Dictionary    docSubject=${row[0]}    addMethod=1    docNotes=null    docStatus=4    docDate=${row[1]}    docType=null    fileCode=null    fileSerial=null    fileId=null    mainClassification=null    subClassification=null    ou=${row[2]}   registryOU=${row[3]}    securityLevel=1    priorityLevel=0    refDocNumber=${row[4]}       mainSiteId=${row[5]}   subSiteId=${row[6]}   refDocDate=${row[7]}   followupStatus=1    followupDate=null    siteType=3
[Return]    ${entity}
IN Content
[Arguments]    ${row}
${content}=    Create Dictionary    content=${row[8]}
${files}=      Create List       content=${row[8]}
[Return]       ${content}
Get File Name
[Arguments]  ${file_path}
${path_components}=  Split String  ${file_path}  /
${file_name}=  Get From List  ${path_components}  -1
[Return]  ${file_name}
Add and Archive
[Arguments]     ${file_path}
${records}=    Read Csv File To List    ${EXECDIR}${file_path}    delimiter=,
FOR    ${row}    IN    @{records}
${entity}=     IN Entity    ${row}
Log To Console     the entity body : ${entity}
    ${content}=   IN Content    ${row}
    Log To Console     the Content body : ${content}
    ${boundary}=    Generate Random String    length=10    chars=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
    ${headers}=  Create Dictionary  Content-Type=multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
    ${data}=    Create Dictionary    entity=${entity}    content=${content}
    Log To Console     the request body : ${data}
    ${content_exists}=  Run Keyword And Return Status  Dictionary Should Contain Key  ${data}  content
    Set Variable If    ${content_exists}    ${data["content"]}    ${content}
    ${entity_exists}=  Run Keyword And Return Status  Dictionary Should Contain Key  ${data}  entity
    Set Variable If    ${entity_exists}    ${data["entity"]}    ${entity}
    Log To Console     the request body : ${data}
    run keyword if    ${content_exists}    Set Variable    ${data["content"]}    ${content}
    run keyword if    ${entity_exists}    Set Variable    ${data["entity"]}    ${entity}
    ${data}=        Evaluate    {'entity':(None,${entity}) ,'content': (None,${content})}
    Log To Console     the request body : ${data}
    ${response}=  POST On Session    app_User    ${endpoint}  headers=${headers}  data=${data}
    # ${docId}=    Set Variable    ${response.json()['rs']}
    # Log    Added incoming correspondence with doc ID ${docId}
    # ${archive_response}=    POST On Session    app_User    /url/${docId}/archive
    # Log    ID ${docId}
    BREAK
END
*** Test Cases ***
login
[Tags]      Login
Login    “jsonfilepath”
Add
[Tags]
Add and Archive     “csvfilepath”
after run all keyword passed but i have 500 error at post step
KEYWORD ${response} = RequestsLibrary . POST On Session app_User , ${endpoint}, headers=${headers}, data=${data}
Documentation:	
Sends a POST request on a previously created HTTP Session.
Start / End / Elapsed:	20230423 15:08:17.809 / 20230423 15:08:18.272 / 00:00:00.463
15:08:18.159	INFO	POST Request : url=full url
path_url=${endpoint}
headers={‘User-Agent’: ‘python-requests/2.28.2’, ‘Accept-Encoding’: ‘gzip, deflate’, ‘Accept’: ‘/’, ‘Connection’: ‘keep-alive’, ‘app-auth-header’: ‘token’, ‘Content-Type’: ‘multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW’, ‘Content-Length’: ‘413’}
body=entity=docSubject&entity=addMethod&entity=docNotes&entity=docStatus&entity=docDate&entity=docType&entity=fileCode&entity=fileSerial&entity=fileId&entity=mainClassification&entity=subClassification&entity=ou&entity=registryOU&entity=securityLevel&entity=priorityLevel&entity=refDocNumber&entity=mainSiteId&entity=subSiteId&entity=refDocDate&entity=followupStatus&entity=followupDate&entity=siteType&content=content
15:08:18.160	INFO	POST Response : fullurl
status=500, reason=Internal Server Error
headers={‘Vary’: ‘Origin, Access-Control-Request-Method, Access-Control-Request-Headers’, ‘Content-Type’: ‘application/json’, ‘X-Content-Type-Options’: ‘nosniff’, ‘X-XSS-Protection’: ‘1; mode=block’, ‘Cache-Control’: ‘no-cache, no-store, max-age=0, must-revalidate’, ‘Pragma’: ‘no-cache’, ‘Expires’: ‘0’, ‘X-Frame-Options’: ‘DENY’, ‘Content-Language’: ‘en-US’, ‘Transfer-Encoding’: ‘chunked’, ‘Connection’: ‘Close’, ‘Date’: ‘Sun, 23 Apr 2023 12:08:16 GMT’}
body={“sc”:500,“ms”:“Required request parameter ‘entity’ for method parameter type String is not present”,“ec”:12000,“lm”:[“2023-04-23 15:08:17,926 INFO [WebContainer : 13]  c.e.c.s.security.LoggingInterceptor.preHandle [31]  - Starting Handling Request Number 5005400083053282480”,“2023-04-23 15:08:17,926 ERROR [WebContainer : 13]  c.e.c.s.e.ExceptionControllerAdvice.exception [72]  - Undefined Exception {}”,“org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter ‘entity’ for method parameter type String is not present”
