Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
@http.route('/api/attendance/', auth='public', methods=['POST'], type='http') 
def index(self, **kw):
data = request.httprequest.data

if i use this request in postman, it will show :

Function declared as capable of handling request of type 'http' but called with a request of type 'json'

could anyone tell me how to solve this problem.


Avatar
Opusti

Are you sending data through the raw body with type JSON in Postman request?

Avtor

Yes

Either you can pass data through 'params' if its HTTP request or change the request type to JSON if you want to send data through the raw body with type JSON,

@http.route('/api/attendance/', auth='public', methods=['POST'], type='json', csrf=False)
def index(self, **kw):
data = kw
print("data",data)
if data['name']:
return {
"status": "Success",
"message": "Posted Successfully"
}

Raw body with type JSON in Postman

{
"params": {
"name":"ABC",
"email":"abc@gmail.com"
}
}

Related Posts Odgovori Prikazi Aktivnost
2
jul. 24
8971
2
avg. 23
3450
0
maj 21
3488
1
okt. 22
8690
1
jul. 25
8324