Hi Everyone,
I have a technical question about using the dataverse api and I do not know where else to ask it.
We are using the api to communicate with the data in a backend c# app. Right now, when working with relations, when we GET the object, we use the following variable for relations:
_###_XXXXXX_value
###: environement prefix
XXXXXXX: variable name
This gives the GUID of the related object.
However, when we POST or PUT, we do some ugly stringreplace of the json, before posting it. For example:
jsonData = jsonData.Replace("_PREF_customfield_value", "PREF_CustomField@odata.bind");
jsonData = jsonData.Replace(THEOBJECTGUID, "/products(" + THEOBJECTGUID + ")");
Here we have a field which is a many to one relationship with products. As you can see, we do some replacements to end up with the following in our json
"PREF_CustomField@odata.bind":"/products(" + THEOBJECTGUID + ")"
This is rather annoying and dirty as this means data manipulation on every json that has relations.
Is there any simpler way? Like a library that will do it automatically? Or another way to format the json?
Cheers