Specify Any Number of Localized Values of a Multilingual Field
For some text boxes on MYOB Acumatica forms, users can type values in multiple languages if multiple locales are configured in MYOB Acumatica. For example, if your MYOB Acumatica instance has the English and French locales activated and multilingual user input configured, you can specify the value of the Description box on the Stock Items (IN202500) form in English or French.
This topic describes a way to specify any number of localized values of a multilingual field. This is the recommended way to do this, as opposed to the way that allows you to specify only all localized values of a multilingual field at once (see Specify All Localized Values of a Multilingual Field).
HTTP Method and URL
To specify any number of localized values of a multilingual field of a record that you
create or update in MYOB Acumatica, you use the PUT
HTTP method and the following URL.
PUT http://<Base endpoint URL>/<Top-level entity>
<Base endpoint URL>
is the URL of the contract-based endpoint through which you are going to work with MYOB Acumatica. This URL has the following format:http://<MYOB Acumatica instance URL>/entity/<Endpoint name>/<Endpoint version>/
.<Top-level entity>
is the name of the entity for which you are going to create a record.
For example, suppose that you want to create a stock item record in a local MYOB Acumatica instance with the name AcumaticaDB by using the system endpoint with the name Default and Version 23.200.001. You should use the following HTTP method and URL to create a record.
PUT http://localhost/AcumaticaDB/entity/Default/23.200.001/StockItem
Parameters
For information on the request parameters, see the Parameters section of Create a Record and the Parameters section of Update a Record.
Request Headers
For information on the request headers to use, see Create a Record or Update a Record depending on the operation you are performing (creation or update of a record).
Request Body
In the HTTP body, in the value
field, you specify the value in the default
language (see Setting Up Languages). You specify the values in other languages in the
Translations/<language_code>
fields. If you specify the values for
only some of the configured languages, the field values in other languages remain
unchanged.
If multiple localized values are provided in the Translations
property of
a field and in the value
property of the same field in the format that is
described in Specify All Localized Values of a Multilingual Field, the request
fails with the following error message: Localized values of a multilingual field cannot
be passed in Value and Translations properties.
Response Status Codes
The following table lists the HTTP status codes that the system returns for a request that creates a record.
Code | Description |
---|---|
200 | The request has been completed successfully. The response of a successful method call contains the created record in JSON format in the response body. The response includes only the values of the fields of the created record that were specified during creation of the record or that were specified to be returned by using the parameters of the request. |
400 | The data specified in the request is invalid. |
401 | The user is not signed in to the system. |
403 | The user has insufficient rights to access the MYOB Acumatica form that corresponds to the entity. |
412 | You have used the If-None-Match header with the * value, and the record already exists. |
422 | The data specified in the request is invalid and the validation errors are returned in the error fields of the response body, as in the following example.
|
429 | The number of requests has exceeded the limit imposed by the license (see License Restrictions for API Users). |
500 | An internal server error has occurred. |
Example
In the example that is mentioned at the beginning of the topic, you need to specify values in
English (which is set as the default language) and French in the
Description box on the Stock Items form. To do
this, you specify the English value of the Description.value field of the
StockItem entity, and the French value in the
Description.Translations.fr
field of the entity. See below for an example
of a stock item record with localized Description field values in JSON
format.
<MYOB Acumatica instance URL>
is the URL of the MYOB Acumatica
instance (such as https://my.acumatica.com/MyInstance). You can omit the instance
name in the URL (that is, you can use https://my.acumatica.com) if the instance
is installed in the root of the website.PUT ?$expand=Translations HTTP/1.1
Host: [<Acumatica ERP instance URL>]/entity/Default/23.200.001/StockItem
Accept: application/json
Content-Type: application/json
{
"InventoryID" : { "value" : "BASESERV" },
"ItemClass" : { "value" : "COMPUTERS" },
"Description" : {
"value": "new description in English",
"Translations": {
"fr": "nouvelle description en français"
}
}
}