rest

Select specific values from JSON output

Select specific values from JSON output Question: I am querying a REST API and I need to select 2 fields from the adapter output below. I basically need to make variables from OUT_Detailed Description and OUT_Vendor Ticket Number: Code: headers = {‘content-type’: ‘application/json’, ‘Authentication-Token’: authToken} response = requests.post(‘http://dev.startschools.local:2031/baocdp/rest/process/:ITSM_Interface:IncidentManagement:QueryIncident/execute’, headers=headers, data=json.dumps(get_query_inc_json())) print(response.text) json_format = json.loads(response) Description …

Total answers: 2

FastAPI GET endpoint returns "405 method not allowed" response

FastAPI GET endpoint returns "405 method not allowed" response Question: A GET endpoint in FastAPI is returning correct result, but returns 405 method not allowed when curl -I is used. This is happening with all the GET endpoints. As a result, the application is working, but health check on application from a load balancer is …

Total answers: 2

Parse GET parameters

Parse GET parameters Question: I have an REST API where the url looks like this: class RRervice(pyrestful.rest.RestHandler): @get(‘/Indicator/{rparms}’) def RR(self, rparms): print(rparms) … So when this codes executes on this URL: http://ip:3000/Indicator/thresh=.8&symbol=AAPL The print I get what I am supposed to get: thresh=.8&symbol=AAPL My question is, is there an API that ensures that certain parameters …

Total answers: 1

POST request to a nested query – python API

POST request to a nested query – python API Question: So i’ve began to create a comment section for users to leave comments under posted events. I’m now trying to set up replies to comments under an event and am having issues. With the code I have, a new link is being generated but it …

Total answers: 1

Django, rest api post ForeignKey

Django, rest api post ForeignKey Question: I am writing REST API in Django, I create model Member where is ForeignKey from User table (auth_user)… method GET work perfectly but with post I have problem… every time I saw error message that fk_id cannot be null. models.py class Member(models.Model): valid_from = models.DateTimeField(null=True, blank=True) valid_to = models.DateTimeField(null=True, …

Total answers: 1

Unable to create URI with whitespace in MarkLogic

Unable to create URI with whitespace in MarkLogic Question: I have created a Marklogic transform which tries to convert some URL encoded characters: [ ] and whitespace when ingesting data into database. This is the xquery code: xquery version "1.0-ml"; module namespace space = "http://marklogic.com/rest-api/transform/space-to-space"; declare function space:transform( $context as map:map, $params as map:map, $content …

Total answers: 2

Problem with getting objects based on ManyToManyField relation

Problem with getting objects based on ManyToManyField relation Question: I have Meal model and Ingredient, Meal have ManyToMany relation to Ingredient. I try to get objects that match by Ingredients models.py class Meal(models.Model): name = models.CharField(max_length=250) description = models.TextField(blank=True, null=True) recipe = models.TextField() is_published = models.BooleanField(default=False) user = ForeignKey(User, verbose_name=’User’, on_delete= models.CASCADE) difficulty = ForeignKey(‘Difficulty’, …

Total answers: 1

How to get specific objects based on ManyToMany field match

How to get specific objects based on ManyToMany field match Question: I’m doing a cookbook app, which help users find meal thay can do with their ingridients. I’m using Django RestFramework, and i need to return list of avaliable meals that user can do, but don’t know how to do search by ingridients My models.py: …

Total answers: 1