orders/create (POST)
This method permits to submit new orders to the client portal.
This method does not provide all the features that you get when submitting orders online (alternative full-feature methods will be added over time).
URL
(POST) /api/orders/create
PARAMETERS
The BODY must be of type form-data
and contain two elements:
data: A JSON object where you include all the various parameters, explained below.
zipFile: The ZIP archive that contains the files to translate or attach as reference material. See further down for explanation.
In Postman, this is done as follows:
Order parameters (“data”)
This is a JSON object with these properties:
client | A JSON object containing the company submitting the order and, optionally, the person within the company. Example:
CODE
To find companies or persons use companies/list and persons/list
| object {int, int?} , Mandatory |
option | The zero-based “option” to select in the order form. An order form may have one (default) or more options a client can choose from. These are configured in Settings > New Order form. If an order form has more than one option, the following option-selector appears: Note: The client ID you have chose directly defines the order form configuration that is selected and which influences how the order will be created. | int, Mandatory |
deadline | The deadline. Always set to a future date and note that this date may get adjusted according to various options in the order form configuration. This date must include time zone information such as in: | datetime, Optional |
reference | The order reference provided by the client. | string, Mandatory |
sourceLanguage | The source language code such as “en” or “fr-BE”. | string, Mandatory |
targetLanguages | An non-empty array of target language codes. Example:
CODE
| string[], Mandatory |
domains | Optional. An array of translation domains to assign to the project. | string[]?, Optional |
instructions | Optional instructions included by client. | string?, Optional |
Appointment specific fields | ||
isAppointment | Optional, false by default. Indicates if this order is an “appointment” request such as a request for interpretation. This requires a specific setup in the order form settings. The date when the appointment starts. | bool?, Optional |
appointmentStartDate | Optional. This field is used with appointments only. The date when the appointment starts. | datetime?, Optional |
appointmentEndDate | Optional. This field is used with appointments only. The date when the appointment ends. | datetime?, Optional |
Custom fields | ||
customFields | Optional array of custom fields to populate. Any custom field defined for Orders can be used. Each array element is an object with properties:
See settings/customfields to enumerate custom fields by API and get the IDs (keys). The “key” can also be found in the Wordbee Translator user interface, see Creating and updating Custom Fields. Go to “Settings” then “Custom fields”, select the “Orders” tab and pick any of the fields. At the bottom of the popup you will find the custom field’s ID. Example:
CODE
| object[{string, string?}], Optional |
Management | ||
manager | Optional. The user ID of the project manager to assign to this order. If not specified no manager is assigned. The ID must refer to an internal user with manager level access rights. See persons/list to enumerate or find persons. | int?, Optional |
parserProfileId | Optional. Generally, this should not be used. The parser profile ID to be used to extract content from the uploaded files. The order form configuration typically lets you define this profile. But, you can override this as well. To find or enumerate available profiles, see: Document format profiles | int?, Optional |
Example:
{
"reference": "order-name",
"client": {
"companyId": 5404018
},
"option": 0,
"sourceLanguage": "en",
"targetLanguages": ["pl-PL", "es-ES"],
"deadline": "2018-08-02T00:00:01.0000000Z",
"customFields": [
{ "key": "CustomStr1", "text": "My value" }
]
}
ZIP archive (“zipFile”)
Include the ZIP file in the BODY form-data with key zipFile
To add reference material, create a folder named ___ref___ to your zip file and place your reference files. Optionally, add "___ref___/" before the file name.
Example: The ZIP archive might contain these files:
file1.docx
file2.docx
marketing/presentation.pptx
___ref___/instructions.docx
The folder hierarchy for files such as for “marketing” above is maintained in both the created order as well as the created project (if it is created by configuration).
RESULTS
The method executes asynchronously. It returns the operation ID which is a number.
Example:
228991
You would then wait a few seconds and request a detailed operation status using trm/status. This will return the status. You need to poll the method and wait 2 to 5 seconds in between polls until the status is Finished or Failed. Please read this page for a detailed explanation: Asynchronous operation
{
"trm": {
"requestid":32230,
"status":"Waiting",
"statusText":"Waiting..."
}
}
If the operation finished with success, the status is Finished and you can access some details on the newly created order in the result property:
{
"trm": {
"requestid": 32230,
"isbatch": false,
"status": "Finished",
"statusText": "Finished!"
},
"result": [
"k": "results",
"v" : { ..... SEE DESCRIPTION BELOW ...... }
]
}
The v node above has a lot of properties. Most of them are self-explanatory and we will only highlight the most important ones:
orderDetails.orderSummary.orderId | The unique order ID which was assigned to the order. You can find back this order or all orders using orders/list . | int |
onlineUrl | The URL to access the new order in a web browser | string |
orderDetails.counts | An array of word count details, per each uploaded document. Example:
CODE
| object[] |
orderDetails.costDetails | Details about the total client cost (if costing is enabled in the order form settings). Example:
CODE
If property orderDetails.incompleteCost is false then this means that the cost details above are incomplete. This can happen if a file failed to be processed, a unit price could not be found in the price list or if any other information is missing. | object |
orderDetails.errors | An order submission is a complex operation and often involves creation of an order, a project, workflows, jobs, assignments to people etc. All this is controlled in the order form configuration. If it happens that some steps did not complete successful but overall the order was created, then you will find in this array a list of errors. Errors will also be visible to the project manager online in the order details. The array is empty or contains errors , see example:
CODE
| object[] |
There are many more properties that you might find useful. An example of an operation result is shown below:
{
"trm": {
"requestid": 0,
"isbatch": false,
"status": "Finished",
"statusText": "Finished!"
},
"result": {
"items": [
{
"k": "results",
"v": {
"onlineUrl": "https://wordbee.local:443/a/team/Orders/OrderView.aspx?x=4fpyzokxshnC6lgeSfFYYebWobP99OlpnKP25%2bG9jnppIvlN5yNd9A%3d%3d",
"orderRef": "api-order-create-1",
"orderDetails": {
"canSeeCost": true,
"costSucceeded": true,
"costFailed": false,
"costFailedText": null,
"hasParsingErrors": false,
"counts": [
{
"name": "hello.html",
"toTranslate": true,
"src": "English (en)",
"trg": "French (fr)",
"words": 2,
"chars": 10,
"pretransident": 2,
"pretransfuzzy": 0,
"similar": 0
}
],
"costDetails": {
"currency": "EUR",
"currencyt": "Euro",
"exvatt": "1.2000 EUR",
"exvat": 1.2,
"incvatt": "1.4160 EUR",
"incvat": 1.416,
"vatrate": 18.0,
"vatratet": "18.00%"
},
"incompleteCost": false,
"orderSummary": {
"reference": "api-order-create-1",
"deadline": "02/08/2022 00:00",
"deadlineInfo": null,
"srct": "English (en)",
"trgt": "French (fr)",
"domt": "",
"taskst": "",
"files": "hello.html",
"refMat": null,
"clientCompany": "Wordbee",
"clientPerson": null,
"companyAddress": "195, rue de Differdange<br />Soleuvre<br />Luxembourg",
"billingAddress": "195, rue de Differdange<br />Soleuvre<br />Luxembourg",
"clientType": "Corporation",
"invIsSame": true,
"orderId": 2540,
"userOrderId": "ID-89"
},
"errors": [],
"noservices": [],
"hasErrors": false
}
}
}
]
},
"custom": null
}
NOTES
The former documentation contained various errors:
The files property is not required and should not be included. It formerly stated that all files in the ZIP must be listed here.
The isDeadlineByFiles is not supported and should NOT be set or included. It formerly stated that you can include a deadline individually per file. Please simply set the general deadline property for the order.