RDS Post/Put Requests
Some services accept incoming data using POST or PUT requests. The methods will behave the same but differ on their response status code. A successful POST request will be responded with “200 OK” while a successful PUT request gets a “201 CREATED”.
Content Type
Every output format is also accepted for upload. The type of the submitted data can be defined either by the url’s filename extension (e.g. “/v2/orders/uploads.csv” for CSV data) or the HTTP header Content-Type
.
Format parameters (like csvSeparator=
) are valid for uploads, too.
Body upload
The preferred method to upload data is to send it as POST body. This is also compatible with the WebDAV protocol if you append the ”&quiet=true
” URL parameter to suppress any response output.
Example
Upload an order in CSV format using curl
:
curl -s -o- -u :KEY -H 'Content-Type: text/csv' -T FILENAME 'https://rds-test.rasch.de/v2/orders/upload'
File upload (multipart/form-data)
If your client doesn’t support defining a POST request body you can also attach the file as multipart/form-data (“http file upload”, as in web forms).
Example
Upload an order in CSV format using an HTML upload formular:
<form enctype="multipart/form-data" action="https://rds-test.rasch.de/v2/orders/upload.csv" method="POST">
<input type="hidden" name="key" value="..." />
CSV File: <input name="doesntmatter" type="file" />
<input type="submit" value="Upload File" />
</form>
Response
A successfull upload will be responded with:
- HTTP Status “200 OK” or “201 Created”
- The message of the action or “SUCCESS” (when not in silent mode)
If you defined the dryrun=
URL parameter, the respond will be:
- HTTP Status “202 Accepted”
- The message of the action or “SUCCESS” (when not in silent mode)
If your data could not be processed the service will respond with HTTP Status 400 and an error message in the response body (when not in silent mode).
You can use the /v2/message service to review the last 15 error messages that were send back to your client.
Special notes on CSV uploads
If you want to use CSV as upload data format, please note that the column’s order doesn’t matter because it will be identified by the column names expected to be in the first data row (“header”).
If you can’t provide the expected column names within the header you have to omit the header within the file and provide the column orders as request parameter csvHeader=...
. Use the same column delimiter as for the data columns.
Disclaimer
Always use our non-productive test service at ‘rds-test.rasch.de’ while developing and testing applications that intend to upload data using POST requests. Additionally, you might want to add the dryrun=true
URL parameter.
Please note that every uploaded data, whether processed successfully or not, will be archived for review and debugging purposes. </public>