When sending HTTP requests to PowerServer, you can specify the HTTP request header to use either application/json or multipart/form-data. Choosing the appropriate header based on the data being sent ensures that your requests are correctly formatted and can be effectively processed by the server.
-
Use application/json when you need to send structured data, such as objects or arrays. This format is ideal for PowerServer Web APIs which expects JSON, as it allows for easier parsing and processing on the server side.
By default, application/json is used.
-
Use multipart/form-data when you need to send large structured data, blobs, or files or a combination of them in a single request. This format is particularly useful for scenarios where network conditions are poor or slow, and you need to send substantial amounts of data to PowerServer (for example, for batch updates or UpdateBlob operations). When multipart/form-data is used, data will be compressed when sending from the client PC to PowerServer, to reduce network transmission time. However, keep in mind that this process requires additional resources in the client PC and PowerServer for compressing and decompressing the data. Please carefully consider the benefits and trade-offs when choosing this format.
Note
All of the PowerServer HTTP request types support multipart/form-data, except the following: ValidationData and VerificationFailed.
You can specify which header to use through the CloudAppSet function.
-
Use the application/json header in all requests. This is the default value.
Integer CloudAppSet ("multipartformdataminsize", "-1")
-
Use the multipart/form-data header in all requests.
Integer CloudAppSet ("multipartformdataminsize", "0")
-
Use the multipart/form-data header only when the data in the request is larger than the specified size, for example, 128 KB. You can specify any positive value (in KB) based on your actual needs.
Integer CloudAppSet ("multipartformdataminsize", "128")