Rest API attribute validation error

I’ve been trying to use the new Api routes on 7.10.10 to insert a range of products into Suite. It seems that it’s a problem with the parser where it’s not correctly processing what I’m sending.

If I send


https://[CRM_INSTANCE]/Api/V8/module/
{
   "data": {
      "attributes": {
         "name": "rest product",
         "price": 14.53
      },
      "type": "AOS_Products"
   }
}

I’m given the response


{
   "errors": {
      "status": 400,
      "title": null,
      "detail": "The option \"attributes\" with value array is invalid."
   }
}

I’ve tried this with other record types and adding/removing attributes and I get the same response,
I can’t see what I’m missing here and anything I try either doesn’t change anything or breaks the interpreter further and I get


{
   "errors": {
      "status": 400,
      "title": null,
      "detail": "The required option \"data\" is missing."
   }
}

Hello,

Someone had alredy post this issue on github.

https://github.com/salesagility/SuiteCRM/issues/6452

You just need to change below file

/Api/V8/Params/Options/Fields.php

and replace this line

const REGEX_FIELD_PATTERN = '/[^\w-,]/';

with

const REGEX_FIELD_PATTERN = '/[^\w-,\s\]/';

Note: this is just for temporary fix and not upgrade safe

Thanks