Closed starryalley closed 6 years ago
Are you enabling debug on the StravaConfig
?
StravaConfig config = StravaConfig.withToken(TOKEN)
.debug()
.build();
That may help to visualize what is being serialized incorrectly to JSON. Also, make sure the path to the GPX file is correct.
Thanks for the quick answer. I found out that I am using the wrong StravaConfig instance to call the API. Now it is working perfectly fine! I'll close this issue soon but one more question about the UploadAPI.
According to Strava document, only "data_type"
and "file"
is required when uploading. Is there any design reason why we should fill in all fields (such as name, description, etc) before we can execute() it?
Thanks again for the support.
No, the Upload API lets you omit those parameters which are not required by Strava. You simply omit the call to the method and it will check internally:
UploadStatus uploadStatus = uploadAPI.uploadFile(new File(gpxDir, filename))
.withDataType(DataType.GPX)
.execute();
I might have missed something but I got this exception if I only call withDataType():
upload failed with exception:java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.sweetzpot.stravazpot.upload.model.UploadActivityType.toString()' on a null object reference
I'm sorry, you are right. All parameters are required at this point. According to Strava docs, it does not state that they are optional though, so you will need to set appropriate values to all the parameters.
Thanks for confirmation. I did read the code and found out so. Didn't know if it's design choice or not since I am only using the upload API part. Thanks again for this awesome library!
Thank you for using it!
Hi,
I plan to use the upload API for my app and I have made sure the returned token is working correctly by using curl to upload the same GPX file.
I am getting MalformedJsonException with this call to UploadAPI:
Exception stack:
I am new to Retrofit API. I can't seem to enable the logging so I can't check what's returning from strava. Could you give me a hint? Thanks so much.