Forum Discussion

hanspgs's avatar
hanspgs
Visitor
6 years ago

rest api to query swagger with Python

Hi,

I want to query swagger using Python with the request package.

Simple queries succeed without any issue:

 

assets_url="http://dev.company.com/asset-service-rest-api/assets?makeName=XXX&modelName=YYY"

assets_field=requests.get(assets_url,headers=headers_auth)

 

This returns a large json with many fields of which I only need 2.

Can I limit the fields returned in the json?
Some implementations of REST allow to specify a list of fields to be retrieved.

 

Is there some way to use boolean logic so that queries like makeName = XXX and (modelName = YYY or modelName=ZZZ) can be done?
Regards Hans

 

 

1 Reply

  • This doesn't seem like a Swagger question, but more of an API design one. Swagger (or rather OpenAPI) is used to describe your API, and Swagger offers various tools to automate some aspects of it, but it is not what's serving the API.