Attempting to upload a photo gives "Geni Will Be Right Back" response

Started by Stephen Friend on Monday, May 3, 2021
Showing all 5 posts
5/3/2021 at 7:55 AM

from the doc https://www.geni.com/platform/developer/help/api?path=photo%2Fadd&a...
it says the URL for adding photos is

https://www.geni.com/api/photo/add?title=foo&text=text-doc

however when I try

POST https://sandbox.geni.com/api/photo/add?access_token=xxx&descrip...

Geni says

<title class="notranslate">Geni Will Be Right Back!</title>

when will Geni be back, to add my photos via the API ?
thanks

Did you provide the file=<base-64 encoded photo> parameter in POST body? I have not tried uploading photos, but that is how uploading documents worked.

5/3/2021 at 11:33 AM

the photo was in the post body

httppost.setEntity(new ByteArrayEntity(b)); //where b is the photo as a byte array

Try with UrlEncodedFormEntity and check that content type is application/x-www-form-urlencoded.

5/3/2021 at 1:09 PM

thanks, that works OK, photo uploaded OK

byte[]b=StringHelper.filetoByteArray(file);
String payload=Base64.getEncoder().encodeToString(b);
NameValuePair np=new BasicNameValuePair("file",payload);
httppost.setEntity(new UrlEncodedFormEntity(Arrays.asList(np)));
httppost.setHeader("Accept", "application/x-www-form-urlencoded");
httppost.setHeader("Content-type", "application/x-www-form-urlencoded");

Showing all 5 posts

Create a free account or login to participate in this discussion