rest

Adding mongoDB document-array-element using Python Eve

半城伤御伤魂 提交于 2021-02-07 06:47:49
问题 Background: (using Eve and Mongo) I'm working in Python using the Eve REST provider library connecting and to a mongoDB to expose a number of REST endpoints from the database. I've had good luck using Eve so far, but I've run into a problem that might be a bit beyond what Eve can do natively. My problem is that my mongoDb document format has a field (called "slots"), whose value is a list/array of dictionaries/embedded-documents. So the mongoDB document structure is: { blah1: data1, blah2:

How to rename (exposed in API) filter field name using django-filters?

那年仲夏 提交于 2021-02-07 06:29:08
问题 As the question states - I'm trying to rename the filter field name exposed in my API. I have the following models: class Championship(Model): ... class Group(Model): championship = ForeignKey(Championship, ...) class Match(Model): group = ForeignKey(Group, ...) I have exposed all of these models in REST API. I've defined filter_fields for the Match model: class MatchViewSet(ModelViewSet): filter_fields = ['group__championship'] ... This way, I can filter for specific championship's matches

Is it valid to modify a REST API representation based on a If-Modified-Since header?

*爱你&永不变心* 提交于 2021-02-07 06:18:12
问题 I want to implement a "get changed values" capability in my API. For example, say I have the following REST API call: GET /ws/school/7/student This gets all the students in school #7. Unfortunately, this may be a lot. So, I want to modify the API to return only the student records that have been modified since a certain time. (The use case is that a nightly process runs from another system to pull all the students from my system to theirs.) I see http://blog.mugunthkumar.com/articles/restful

How can I accept arbitrary JSON objects in my REST WCF service?

六月ゝ 毕业季﹏ 提交于 2021-02-07 06:15:46
问题 I want to implement a service method like this: [OperationContract] [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)] public void MakeShape(string shape, string color, IDictionary<string, object> moreArgs) { if (shape == "circle") { MakeCircle(color, moreArgs); } } My clients POST objects like: { "shape":"circle", "color": "blue", "radius": 42, "filled":true, "annotation": {"date":"1/1/2012", "owner":"George"} } At the call to MakeCircle, moreArgs would

How can I accept arbitrary JSON objects in my REST WCF service?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-07 06:15:10
问题 I want to implement a service method like this: [OperationContract] [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)] public void MakeShape(string shape, string color, IDictionary<string, object> moreArgs) { if (shape == "circle") { MakeCircle(color, moreArgs); } } My clients POST objects like: { "shape":"circle", "color": "blue", "radius": 42, "filled":true, "annotation": {"date":"1/1/2012", "owner":"George"} } At the call to MakeCircle, moreArgs would

Spring Boot request header return null value

我只是一个虾纸丫 提交于 2021-02-07 05:29:06
问题 I have a spring boot project which has some Rest APIs in it. I have two custom headers named request_date and tenant respectively. I am trying to read the value of these headers in an interceptor, but it reads the value for only tenant and returns null for request_date . Important I use a filter to wrap the request object because I want to read the request body later. There is a filter to add CORS headers. When I run my project on localhost and debug the code, I am successfully able to read

OAuth is not secure or I didn't understand it?

浪尽此生 提交于 2021-02-07 05:12:40
问题 I was thinking about security for my REST web Service API, and decided to take a look at others large services and how they do it. As an example I decided to study Twitter's OAuth. After reading beginners guide I'm a little be confused and shocked. As I understood it's Service provider responsibility to authenticate user and to show User what kind of access consumer is demanding (for example it want's read only access to specific resource). But I saw service providers that doesn't inform user

OAuth is not secure or I didn't understand it?

徘徊边缘 提交于 2021-02-07 05:08:17
问题 I was thinking about security for my REST web Service API, and decided to take a look at others large services and how they do it. As an example I decided to study Twitter's OAuth. After reading beginners guide I'm a little be confused and shocked. As I understood it's Service provider responsibility to authenticate user and to show User what kind of access consumer is demanding (for example it want's read only access to specific resource). But I saw service providers that doesn't inform user

OAuth is not secure or I didn't understand it?

左心房为你撑大大i 提交于 2021-02-07 05:05:42
问题 I was thinking about security for my REST web Service API, and decided to take a look at others large services and how they do it. As an example I decided to study Twitter's OAuth. After reading beginners guide I'm a little be confused and shocked. As I understood it's Service provider responsibility to authenticate user and to show User what kind of access consumer is demanding (for example it want's read only access to specific resource). But I saw service providers that doesn't inform user

Azure Storage Table API REST with Curl

不羁岁月 提交于 2021-02-07 04:38:35
问题 I need help to print an entity with Rest in shell script. I tried several ways, but without success. Here is my code, running it, it will return all entities in my table. But I need it to return only a specific value and that is only using PartitionKey. #!/bin/bash # List the tables in an Azure storage container. storage_account="Secret" table_name="teste" access_key="Secret" table_store_url="table.core.windows.net" authorization="SharedKey" request_method="GET" request_date=$(TZ=GMT LC_ALL