var association = { '@odata.id': formContext.context.getClientUrl() + /api/data/v9.2/ + relatedEntitySetName + ( + relatedId + ) };
var req = new XMLHttpRequest();
req.open(POST, formContext.context.getClientUrl() + /api/data/v9.2/ + primaryEntitySetName + ( + primaryId + )/ + relationshipName + /$ref, true);
req.setRequestHeader(Accept, application/json);
req.setRequestHeader(Content-Type, application/json; charset=utf-8);
req.setRequestHeader(If-None-Match, null);
req.setRequestHeader(OData-MaxVersion/, 4.0);
req.setRequestHeader(OData-Version, 4.0);
Apparently quotes are removed during posting. Assume they're in their proper places.