Help me debug API PATCH call to Bubble.io (400 Bad Request)
Ältere Kommentare anzeigen
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]; % append the object unique ID
data = struct('Main_Brand','JBL'); % some data to test
jData = jsonencode(data); % encode to JSON array
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.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Web Services finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!