Forum Discussion

brengl's avatar
brengl
Contributor
10 months ago

API 2.0 error 605, api.request body size limitation

Hi, I am scripting the creation of articles using the API 2.0 and  multipart FORM  POST that contains a rather lengthy HTML table of data in the message body, along with 2 file attachments. 
I am running up against what appears to be a size limit in the API:

{"status":"error","message":"The api.request parameter, or the value passed in for the api.request parameter, is not valid.","data":{"type":"error_data","code":605,"developer_message":"This value must be shorter than 100,000 characters in length.","more_info":""},"metadata":{}}++ echo

Is there a way around this?
FWIW here is how I am constructing the request and sending it:


apirequest="apirequest.json"
cat <<EOF > "${apirequest}"
{
"data":{
"type":"message",
"subject":"$SUBJECT",
"body":"$MSGBODY",
"board":{
"type":"board",
"id":"test-kb"
},
"attachments":{
"list_item_type":"attachment",
"items":[
{
"type":"attachment",
"field":"attachment1",
"filename":"$ADDRESSEDFN"
},
{
"type":"attachment",
"field":"attachment2",
"filename":"$KNOWNFN"
}
]
}
}
}
EOF

set -x

RESP=&(curl -X POST https://communities.sas.com/api/2.0/messages/ -H "content-type: multipart/form-data" -H "li-api-session-key: $SESSIONKEY" -F "api.request=<$apirequest" -F "attachment1=@$ADDRESSED" -F "attachment2=@$KNOWN")
echo $RESP

 

Note that I can post the same message body with API 1.0 with no problem using the "message.body" parameter. It does not have issue with the size, but I could not determine how to do the multi-part FORM with the attachments using API 1.0, so that is why I am trying API 2.0. 

  • I am now trying a different approach, using the original API  V1 to post the message, then using v2.0 to update the message with the needed attachments, per Update message (khoros.com) . It is still not clear why v2.0 disallows the message body when v1 has no problem with it. 

  • I am now trying a different approach, using the original API  V1 to post the message, then using v2.0 to update the message with the needed attachments, per Update message (khoros.com) . It is still not clear why v2.0 disallows the message body when v1 has no problem with it. 

    • MohammedF's avatar
      MohammedF
      Moderator

      brengl I would suggest initiating a support ticket so our support team can investigate this and help.