Ron McLeod wrote:
Ricardo Carvalho wrote:Spring i think..
You probably need to sort that out to move forward.
If you can share some example code, maybe someone can figure out what you are using.
Yes, i was writting on mobile phone.
Just for a little context, i'm calling an API from a game, and this is what i call:
http://api.planets.nu/games/list?username=wasp
If i put that on the browser i get a json:
[{"name":"Athos IV Sector Campaign","description":"No wasp, Max advantage 600, planets limit ships 20\/1\/0, fog of war, blinded scores, random spaced home worlds, low minerals. Allies 0, Share Intel 1, Safe Passage 1. Host 2\/week.","shortdescription":"Custom Game","status":2,"datecreated":"5\/12\/2023 12:45:03 PM","dateended":"1\/1\/0001 12:00:00 AM","maptype":3,"gametype":2,"wincondition":1,"difficulty":1.9214988730278,"tutorialid":0,"requiredlevelid":7,"maxlevelid":0,"masterplanetid":172,"quadrant":0,"mintenacity":0,"faststart":10,"turnsperweek":0,"yearstarted":149,"isprivate":false,"scenarioid":0,"createdby":"smi","turn":15,"slots":11,"turnstatus":"1_34_6789AB","hostdays":"__T__F_","slowhostdays":"__T__F_","hosttime":"22:00","lastbackuppath":"d:\\planetsdata\\backups\\game563278\\turn14-638409052648798010.zip","nexthost":"1\/19\/2024 10:00:00 PM","allturnsin":fals......
If i do this code:
package com.example.consumingrest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class ConsumingRestApplication {
private static final Logger log = LoggerFactory.getLogger(ConsumingRestApplication.class);
public static void main(
String[] args) {
SpringApplication.run(ConsumingRestApplication.class, args);
}
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder.build();
}
@Bean
@Profile("!test")
public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
return args -> {
String ret = restTemplate.getForObject(
"http://api.planets.nu/games/list?username=wasp",String.class);
log.info("RESULTADO: " + ret);
};
}
}
I get this
: RESULTADO: $K�e ��Vko�6�+w��9zX�$� ���4���.Z�-���T\o��!��y��2`� �0��<�<���$�xP�Q�^�FW��J�%�z&v���J��
%a�Zў�>�W����I�v�QR�2ɭ�VtiDo(�Vg���[�#���i�
Y�L�47!i&kՑ�Y��Fu��J�5�Z��NH�YkftѶ�B���iN/��-�X�-���WM<�_����������(m�r9���8``�LP&�Y^i��f@�$JR��r��QJo_�w}�*ی��E>t�:��C��0�!ո@��������Nl��Z{�rV$���e
If i try with python, it uncompress automatically
Is this enough? what else do you need?
Thanks