I created the interface manually, get its configuration by the GET method, deleted it from the obtained JSON deleted some keys (fortilink, ipv6, snmp, q_origin_key, switch-controller, etc. ) and when I tried to POST it back I got the same result.
The vlan interface had to be created in a prod vdom on a ag_inside aggregated interface, which belongs to the root vdom. The admin profile for the REST API administrator allows full control of the device. I tried to post the JSON with a specified vdom in the URL, but it didn't help.
I tried to create the interface on an other FortiGate (500E) device, and the code works there. The only difference is, the aggregated link on which I create the vlan interface belongs to the same vdom in where I create the vlan. Could this cause the problem? If not, what is the reason?