Hello members:

Could any one shed a light on this issue?

I successful run this POST request using Postman:
JSON body
"
        {
                "location" : {
                "value" : { "href":
"http://localhost:8080/restful/objects/businessentities.Location/46"; }
                },
                "asset" : {
                "value" : { "href":
"http://localhost:8080/restful/objects/businessentities.Asset/36"; }
                },
                "audit" : {
                "value" : { "href":
"http://localhost:8080/restful/objects/businessentities.Audit/2"; }
                }
        }
"

However on javascript:
"
          var data =    {
            "location" : {
              "href" :
"http://localhost:8080/restful/objects/businessentities.Location/47";
            },
            "asset"    : {
                "href":
"http://localhost:8080/restful/objects/businessentities.Asset/36";
            },
            "audit"    : {
                "href" :
"http://localhost:8080/restful/objects/businessentities.Audit/2";
            }
          }

          // Post the new data
          var a2 = new AuditItemCreate();
          a2.$save(data);
          ...
"

i am getting this failure (as displayed by chrome developer tools):
"
data:
asset:
invalidReason:"Expected a link (because this object's type is not a
value) but found no 'href'"
value:"{"href":"http://localhost:8080/restful/objects/businessentities.Asset/36"}";
__proto__:Object
audit:
invalidReason:"Expected a link (because this object's type is not a
value) but found no 'href'"
value:"{"href":"http://localhost:8080/restful/objects/businessentities.Audit/2"}";
__proto__:Object
location:
invalidReason:"Expected a link (because this object's type is not a
value) but found no 'href'"
value:"{"href":"http://localhost:8080/restful/objects/businessentities.Location/47"}";
__proto__:Object
x-ro-invalidReason:"Mandatory"
"

What is wrong in this javascript code?

Thank you very much, Eder

Reply via email to