You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get the images api to work to download custom images of the characters from the help api, but get FileNotFound exceptions regardless of what characters I ask for, what options I give (rarity, level, zeta) or whether they are toons or ships.
I don't see any documentation on the image api at https://api.swgoh.help/swgoh so it is hard for me to tell what the requested url should be nor try it with just a curl command, so I'm unsure if the issue is with .help or with the wrapping api.
Below the simplest main I could come up with that demonstrates the issue. I'm using version 4.2.1 of the api, but it was failing with 4.1.0 as well.
Going back to 4.0.1 removes the ability to use the SwgohAPIFilter, but the relevant pieces don't work with that version either.
Going back to 3.2 removes the ToonImageRequestBuilder so I didn't test any further back than 4.0.0.
importjava.awt.image.BufferedImage;
importjava.util.HashMap;
importjava.util.Map;
importhelp.swgoh.api.SwgohAPI;
importhelp.swgoh.api.SwgohAPIBuilder;
importhelp.swgoh.api.SwgohAPIFilter;
importhelp.swgoh.api.image.ShipImageRequestBuilder;
importhelp.swgoh.api.image.ToonImageRequestBuilder;
publicclassTest {
publicstaticvoidmain(String[] args) throwsException {
SwgohAPIapi = newSwgohAPIBuilder()
.withUsername( "daker13" )
.withPassword( "************" )
.build();
try {
System.out.println("First get some character info to prove I've got the api setup correctly");
intallyCode = 421838524;
Map<String, Object> matchCriteria = newHashMap<>();
matchCriteria.put( "baseId", "GREEDO" );
matchCriteria.put( "rarity", 7 );
StringgreedoJson = api.getSupportData( SwgohAPI.Collection.unitsList,
matchCriteria,
SwgohAPI.Language.English,
newSwgohAPIFilter( "nameKey", "combatType", "descKey", "thumbnailName", "baseId" )
).get();
System.out.println(greedoJson);
} catch(Exceptione) {
e.printStackTrace();
}
System.out.println("Now try the image api using the example at https://github.com/j0rdanit0/api-swgoh-help");
//raw bytes of an imageStringbaseId = "DARTHTRAYA"; //a full list of baseIds can be obtained through the "unitsList" collectiontry {
byte[] bytes = api.getImage(
newToonImageRequestBuilder(baseId)
.withStars(7)
.withLevel(85)
.withGear(12)
.build()
).get();
} catch(Exceptione) {
e.printStackTrace();
}
System.out.println("try with the buffered image too just to show both aren't working");
//image in the form of a BufferedImagetry {
baseId = "TIEREAPER"; //a full list of baseIds can be obtained through the "unitsList" collectionBufferedImageimage = api.getBufferedImage(
newShipImageRequestBuilder(baseId)
.withLevel(50)
.withStars(5)
.addPilot("DEATHTROOPER", 85, 11, 7, null)
.addPilot("SHORETROOPER", 75, 5, 5, null)
.build()
).get();
} catch(Exceptione) {
e.printStackTrace();
}
}
}
The output from running the above program is:
First get some character info to prove I've got the api setup correctly
[{"thumbnailName":"tex.charui_greedo","nameKey":"Greedo","combatType":1,"descKey":"Deadly Attacker that gains extra attacks from Critical Hits","baseId":"GREEDO"}]
Now try the image api using the example at https://github.com/j0rdanit0/api-swgoh-help
java.util.concurrent.ExecutionException: help.swgoh.api.exception.SwgohAPIException: Unable to complete request.
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
at Test.main(Test.java:45)
Caused by: help.swgoh.api.exception.SwgohAPIException: Unable to complete request.
at help.swgoh.api.SwgohAPIClient.lambda$getImage$0(SwgohAPIClient.java:544)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.io.FileNotFoundException: https://api.swgoh.help/image/char/DARTHTRAYA?level=85&gear=12&rarity=7
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at java.net.URL.openStream(URL.java:1045)
at help.swgoh.api.SwgohAPIClient.getImage(SwgohAPIClient.java:643)
at help.swgoh.api.SwgohAPIClient.lambda$getImage$0(SwgohAPIClient.java:532)
... 6 more
try with the buffered image too just to show both aren't working
java.util.concurrent.ExecutionException: help.swgoh.api.exception.SwgohAPIException: Unable to complete request.
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
at Test.main(Test.java:61)
Caused by: help.swgoh.api.exception.SwgohAPIException: Unable to complete request.
at help.swgoh.api.SwgohAPIClient.lambda$getBufferedImage$1(SwgohAPIClient.java:570)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.io.FileNotFoundException: https://api.swgoh.help/image/ship/TIEREAPER?pilots=DEATHTROOPER-7-85-11-null%7CSHORETROOPER-5-75-5-null&level=50&rarity=5
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at java.net.URL.openStream(URL.java:1045)
at help.swgoh.api.SwgohAPIClient.getBufferedImage(SwgohAPIClient.java:651)
at help.swgoh.api.SwgohAPIClient.lambda$getBufferedImage$1(SwgohAPIClient.java:563)
... 6 more
Process finished with exit code 0
If there is any additional data I can provide, please let me know.
Thanks,
Greg
The text was updated successfully, but these errors were encountered:
I just asked about this on the Swgoh.help discord server. The image api has apparently been removed from the underlying api. So we're going to have to get these images some other way. This repo should probably be updated to remove ImageRequest or at least mark it as deprecated.
I'm trying to get the images api to work to download custom images of the characters from the help api, but get FileNotFound exceptions regardless of what characters I ask for, what options I give (rarity, level, zeta) or whether they are toons or ships.
I don't see any documentation on the image api at https://api.swgoh.help/swgoh so it is hard for me to tell what the requested url should be nor try it with just a curl command, so I'm unsure if the issue is with .help or with the wrapping api.
The error message is always of the form:
Below the simplest main I could come up with that demonstrates the issue. I'm using version 4.2.1 of the api, but it was failing with 4.1.0 as well.
Going back to 4.0.1 removes the ability to use the SwgohAPIFilter, but the relevant pieces don't work with that version either.
Going back to 3.2 removes the ToonImageRequestBuilder so I didn't test any further back than 4.0.0.
The output from running the above program is:
If there is any additional data I can provide, please let me know.
Thanks,
Greg
The text was updated successfully, but these errors were encountered: