Unsure why the following request is erroring as follows:
Error processing request stream. The request should be a valid top-level resource object.
The request (certain details have been obfuscated for obvious reasons):
POST http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/someSet HTTP/1.1
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8
Accept-Encoding: gzip, deflate
Content-Length: 387
Host: someUrl.com
{
"paymentid": {
"Id": "00e3f661-8d28-e321-896e-00155dfd1d05",
"LogicalName": "payment"
},
"invoiceid": {
"Id": "00e3f661-8d28-e411-896e-00155dfd1d05",
"LogicalName": "invoice"
},
"AppliedAmount": 1317.53000,
"name": "Payment Applied",
"postingstatus": "Posted",
"transactioncurrencyid": {
"Id": "80870a9b-329e-d421-8a22-00155d025001",
"LogicalName": "transactionCurrency"
}
}
All logical names have been derived from running the following query:
select
LogicalName
from
NHLPA_MSCRM.dbo.EntityView
where
BaseTableName = 'paymentbase' -- | invoicebase | transactioncurrencybase
Summary: use the
OrganizationData.svc/someSet
url to get a list of the existing entities, providing perfect reference to the necessary JSON structure (minus_metaData
properties)
So the problem ended up being quite simple.
The entity someSet
was not the problem, as denoted by being able to access http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/someSet
with no issues.
Drilling further into things it was the inner Logical Entity's (payment, invoice, transactioncurrency). As mentioned these logical names were derived from the database, which matched the entity settings page (image below).
However, all of the following urls would not resolve:
http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/paymentSet
http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/invoiceSet
http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/transactionCurrencySet
The problem was that despite being lowercase in all places where you'd find the logical name of an entity, the first letter actually needed to be capitalized like:
http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/PaymentSet
http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/InvoiceSet
http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/TransactionCurrencySet
And the working payload:
{
"paymentid": {
"Id": "00e3f661-8d28-e321-896e-00155dfd1d05",
"LogicalName": "Payment"
},
"invoiceid": {
"Id": "00e3f661-8d28-e411-896e-00155dfd1d05",
"LogicalName": "Invoice"
},
"AppliedAmount": 1317.53000,
"name": "Payment Applied",
"postingstatus": "Posted",
"TransactionCurrencyId": {
"Id": "80870a9b-329e-d421-8a22-00155d025001",
"LogicalName": "TransactionCurrency"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.