hello im using android app trying to parse the content from this api
BaseURL "/v1/"
URL
/stories
Parameters
page as int, optional
size as int, optional
location as 1 | 0, optional, default 0
Notes:
1 for get all stories with location
0 for all stories without considering location
Method
GET
Headers
Authorization: Bearer <token>
Response
{
"error": false,
"message": "Stories fetched successfully",
"listStory": [
{
"id": "story-FvU4u0Vp2S3PMsFg",
"name": "Dimas",
"description": "Lorem Ipsum",
"photoUrl": "/images/stories/photos-1641623658595_dummy-pic.png",
"createdAt": "2022-01-08T06:34:18.598Z",
"lat": -10.212,
"lon": -16.002
}
]
}
i already followed the api doc but i keep getting 400 bad req
this is my logcat
my api service
interface ApiService {
@GET("stories")
suspend fun getStories(
@Header("Authorization") authorization: String,
@Query("page") page: Int,
@Query("size") size: Int,
): StoryResponse
}
my story repository
class StoryRepository(
private val apiService: ApiService,
private val sessionManager: SessionManager
) {
suspend fun getStories(token: String): List<ListStoryItem> {
val token = sessionManager.getToken()
val page = 1
val size = 10
return apiService.getStories("Bearer $token", page, size).listStory
}
}
i already test with thunder client and it return 200 this token is from prev test