[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Upload file to REST (Data Object WebSpeed service)

  • Thread starter Thread starter Peter Judge
  • Start date Start date
Status
Not open for further replies.
P

Peter Judge

Guest
Louis, From the docs you linked, it looks like the operations (error/success) expect the same JSON responses Event Data e.files Array Lists the files that were uploaded or removed. Each file has: name extension - The file extension including the leading dot. For example, .jpg, .png, an so on. size - The file size in bytes. If not available, the value is null. uid - The unique identifier of the file or batch of files. e.operation String The upload or remove operation. e.XMLHttpRequest Object Represents either the original XHR that is used for the operation or a stub that contains: responseText status statusText Before you access any other fields, verify that this is an actual XHR. The docs aren’t clear on how you signal an error vs success (I’d think a status code). You can do this with a custom map file too. You can build the whole JSON yourself (easiest for now, I think) by tweaking your method’s signature to be METHOD PUBLIC INTEGER UploadFile( INPUT mpEntity AS OpenEdge.Net.MultipartEntity, OUTPUT pResponse AS JsonObject): And the mapping entry to { "services" : { "UI" : { "version" : "1.0.0" , "operations" : { "/UploadFile" : { "POST" : { "contentType" : "application/json" , "entity" : { "name" : "UploadFileClass" , "function" : "UploadFile" , "arg" : [ { "ablName" : "" , "ablType" : "INTEGER" , "ioMode" : "RETURN" , "msgElem" : { "type" : "StatusCode" , "name" : null } }, { "ablName" : "mpEntity" , "ablType" : "CLASS OpenEdge.Net.MultipartEntity" , "ioMode" : "INPUT" , "msgElem" : { "type" : "BODY" , "name" : null } }, { "ablName" : "pData" , "ablType" : "CLASS Progress.Json.ObjectModel.JsonObject" , "ioMode" : "OUTPUT" , "msgElem" : { "type" : "BODY" , "name" : null } } ] } } } }, "schemas" : null } } }

Continue reading...
 
Status
Not open for further replies.
Back
Top