FuelSDK-Java icon indicating copy to clipboard operation
FuelSDK-Java copied to clipboard

[BUG] Issue updating ETAsset using client.update()

Open lgarciaruiz opened this issue 4 years ago • 0 comments

Describe the bug Error invoking update method for ETAsset

To Reproduce Retrieve an ETAsset > set content using setContent() > attempt to update the asset in SFMC using client.update(asset);

Expected behavior Expectation was for asset in SFMC to have the updated content

Stack Trace Exception in thread "main" com.exacttarget.fuelsdk.ETSdkException: error invoking update method for type class com.exacttarget.fuelsdk.ETAsset at com.exacttarget.fuelsdk.ETClient.createUpdateDelete(ETClient.java:1101) at com.exacttarget.fuelsdk.ETClient.update(ETClient.java:940) at Package.Test.updateAssetByID(Test.java:91) at Package.Test.main(Test.java:48) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.exacttarget.fuelsdk.ETClient.createUpdateDelete(ETClient.java:1099) ... 3 more Caused by: com.exacttarget.fuelsdk.ETSdkException: error setting request method: PATCH at com.exacttarget.fuelsdk.ETRestConnection.sendRequest(ETRestConnection.java:246) at com.exacttarget.fuelsdk.ETRestConnection.sendRequest(ETRestConnection.java:223) at com.exacttarget.fuelsdk.ETRestConnection.patch(ETRestConnection.java:161) at com.exacttarget.fuelsdk.ETRestObject.createUpdateDelete(ETRestObject.java:408) at com.exacttarget.fuelsdk.ETRestObject.update(ETRestObject.java:310) ... 8 more Caused by: java.net.ProtocolException: Invalid HTTP method: PATCH at java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:440) at sun.net.www.protocol.http.HttpURLConnection.setRequestMethod(HttpURLConnection.java:553) at sun.net.www.protocol.https.HttpsURLConnectionImpl.setRequestMethod(HttpsURLConnectionImpl.java:388) at com.exacttarget.fuelsdk.ETRestConnection.sendRequest(ETRestConnection.java:244) ... 12 more

Code snippet public static void main (String[] args) throws ETSdkException { ETClient client = new ETClient(); ETAsset asset = client.retrieveObject(ETAsset.class, "id=" + assetID); asset.setContent("new text"); ETResponse<ETAsset> response = client.update(asset); for (ETResult<ETAsset> result : response.getResults()) { System.out.println(result); } }

Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (e.g. gif) is not sufficient.

Environment

  • SDK Version 1.5.0
  • Java/ JDK version 1.8

The bug has the severity

  • [ ] Critical: The defect affects critical functionality or critical data. It does not have a workaround.
  • [ ] Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.
  • [ ] Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.
  • [ ] Trivial: The defect does not affect functionality or data. It does not even need a workaround. It does not impact productivity or efficiency. It is merely an inconvenience.

Additional context Add any other context about the problem here.

lgarciaruiz avatar Jun 04 '20 23:06 lgarciaruiz