I have successfully pulled in data from my Bubble database into a MATLAB structure. Now I want to make some changes and make a PATCH or POST, but I keep getting a 400 "Bad Request" error.
Here's part of my MATLAB script:
optWrite = weboptions('RequestMethod','patch','ArrayFormat','json','MediaType','application/json','ContentType','json','CharacterEncoding','US-ASCII','HeaderFields',headerFields);
url = [api A.response.results.x_id];
data = struct('Main_Brand','JBL');
jData = jsonencode(data);
response = webwrite(url,jData,optWrite)
And here's the error:
Error using matlab.internal.webservices.HTTPConnector/copyContentToByteArray (line 396)
The server returned the status 400 with message "Bad Request" in response to the request
to URL
https://app.subaligner.com/version-test/api/1.1/obj/alignments/1608182007182x959586279321858200.
Error in readContentFromWebService (line 46)
byteArray = copyContentToByteArray(connection);
Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);
Error in playground (line 15)
response = webwrite(url,jData,optWrite)
If it would be helpful I can also share the GET request I'm using to pull in data, but I don't seem to be having a problem with that part. I don't understand how to debug the PATCH request when I just keep getting the same error over and over again.