Divar-Interview

GET Places list
https://android-interview.divar.dev/api/v1/place/list
HEADERS

Content-Type
application/json

None

x-access-token
Basic YXBpa2V5OjY5Y1dxVW8wNGhpNFdMdUdBT2IzMmRXZXQjsllsVzBtSkNiwU9yLUxEamNDUXFMSzJnR29mS3plZg==

User token

Example Request
                                                
GET https://android-interview.divar.dev/api/v1/place/list
                                            
Example Response
200 - OK
                                                
GET https://android-interview.divar.dev/api/v1/place/list
                                            
Example Response
401 - Unauthorized
                                                    
{
    "success": false,
    "message": "شناسه\u200cی کاربر نامعتبر است."
}
                                                
POST Find place
https://android-interview.divar.dev/api/v1/place/find
HEADERS

x-access-token
Basic YXBpa2V5OjY5Y1dxVW8wNGhpNFdMdUdBT2IzMmRXZXQjsllsVzBtSkNiwU9yLUxEamNDUXFMSzJnR29mS3plZg==

User token

BODY raw

                                                  
                                                    
{
    "lat":35.717358, //current city latitude
    "long":51.375076 //current city longitude
}
                                                  
                                              
Example Request
                                                
POST https://android-interview.divar.dev/api/v1/place/find
{
    "lat":35.717358,
    "long":51.375076
}

                                            
Example Response
200 - OK
                                                    
{
    "name": "تهران",
    "id": 1,
    "slug": "tehran",
    "radius": 25000,
    "centroid": {
        "latitude": 35.717358,
        "longitude": 51.375076
    }
}
                                                
                                                
POST https://android-interview.divar.dev/api/v1/place/find
{
    "lat":35.717358,
    "long":51.375076
}

                                            
Example Response
401 - Unauthorized
                                                    
{
    "success": false,
    "message": "شناسه\u200cی کاربر نامعتبر است."
}
                                                
                                                
POST https://android-interview.divar.dev/api/v1/place/find
{
    "lat":95.717358,
    "long":51.375076
}

                                            
Example Response
404 - Not Found
                                                    
{
    "success": false,
    "message": {
        "title": "GrpcNotFoundError",
        "message": "خارج محدوده"
    }
}
                                                
POST Post list
https://android-interview.divar.dev/api/v1/post/list?city={{selectedCityId}}
HEADERS

x-access-token
Basic YXBpa2V5OjY5Y1dxVW8wNGhpNFdMdUdBT2IzMmRXZXQjsllsVzBtSkNiwU9yLUxEamNDUXFMSzJnR29mS3plZg==

User token

PARAMS

city
{{selectedCityId}}

Selected city id

BODY raw

                                                  
                                                    
{
	"page":0, //current page
  	"last_post_date":0 //last post date from previous page
}
                                                  
                                              
Example Request
                                                
POST https://android-interview.divar.dev/api/v1/post/list?city=1
{
	"page":0,
  	"last_post_date":0
}

                                            
Example Response
200 - OK
                                                
POST https://android-interview.divar.dev/api/v1/post/list?city=-1
{
	"page":0,
  	"last_post_date":0
}

                                            
Example Response
406 - Not Acceptable
                                                    
{
    "success": false,
    "message": "خطا در دریافت اطلاعات"
}
                                                
                                                
POST https://android-interview.divar.dev/api/v1/post/list?city=1
{
	"page":0,
  	"last_post_date":0
}

                                            
Example Response
401 - Unauthorized
                                                    
{
    "success": false,
    "message": "شناسه\u200cی کاربر نامعتبر است."
}
                                                
GET Post view
https://android-interview.divar.dev/api/v1/post/view/{{postToken}}
HEADERS

Content-Type
application/json

None

x-access-token
Basic YXBpa2V5OjY5Y1dxVW8wNGhpNFdMdUdBT2IzMmRXZXQjsllsVzBtSkNiwU9yLUxEamNDUXFMSzJnR29mS3plZg==

User token

Example Request
                                                
GET https://android-interview.divar.dev/api/v1/post/view/gYhqbq3n
                                            
Example Response
200 - OK
                                                
GET https://android-interview.divar.dev/api/v1/post/view/gYhqbq6n
                                            
Example Response
404 - Not Found
                                                    
{
    "success": false,
    "message": {
        "title": "این آگهی حذف شده است."
    }
}
                                                
                                                
GET https://android-interview.divar.dev/api/v1/post/view/gYhqbq3n
                                            
Example Response
401 - Unauthorized
                                                    
{
    "success": false,
    "message": "شناسه\u200cی کاربر نامعتبر است."
}