Jersey Exception : SEVERE: A message body reader for Java class

后端 未结 15 1929
说谎
说谎 2020-11-29 11:08

I have a Jersey based Rest WS which outputs JSON. I am implementing a Jersey Client to invoke the WS and consume the JSON response. The client code I have is below



        
15条回答
  •  孤独总比滥情好
    2020-11-29 11:24

    for Python and Swagger example:

    import requests
    base_url = 'https://petstore.swagger.io/v2'
    def store_order(uid):
        api_url = f"{base_url}/store/order"
        api_data = {
            'id':uid,
            "petId": 0,
            "quantity": 0,
            "shipDate": "2020-04-08T07:56:05.832Z",
            "status": "placed",
            "complete": "true"
            }
        # is a kind of magic..
        r = requests.post(api_url, json=api_data)
        return r
    print(store_order(0).content)    
    

    Most important string with MIME type: r = requests.post(api_url, json=api_data)

提交回复
热议问题