Giter Site home page Giter Site logo

Comments (1)

dkellner avatar dkellner commented on August 17, 2024

I've never used viewonly myself, thanks for bringing this up. I've just tried to reproduce your problems with this (your example is incomplete, so I had to do some guesswork, e.g. you never use CommonColumns and get_current_user_id is not defined).

I've come up with https://github.com/pyeve/eve-sqlalchemy/tree/viewonly/eve_sqlalchemy/examples/viewonly and tried to POST to /nodes, which works fine and GET-ing gives created_by and organization (see below). Can you maybe amend this example to show your problems with viewonly?

$ curl -i -X POST -H "Content-Type: application/json" -d '{}' localhost:5000/nodes
HTTP/1.0 201 CREATED
Content-Type: application/json
Content-Length: 227
Location: http://localhost:5000/nodes/1
Server: Eve/0.7.10 Werkzeug/0.11.15 Python/3.6.6
Date: Mon, 12 Nov 2018 07:54:55 GMT

{"_updated": "Mon, 12 Nov 2018 07:54:55 GMT", "_created": "Mon, 12 Nov 2018 07:54:55 GMT", "_etag": "d4c403081de4d25f9005fa33ef10fcaa4f2b0063", "id": 1, "_links": {"self": {"title": "Node", "href": "nodes/1"}}, "_status": "OK"}

$ curl -i -X POST -H "Content-Type: application/json" -d '{}' localhost:5000/nodes
HTTP/1.0 201 CREATED
Content-Type: application/json
Content-Length: 227
Location: http://localhost:5000/nodes/2
Server: Eve/0.7.10 Werkzeug/0.11.15 Python/3.6.6
Date: Mon, 12 Nov 2018 07:54:57 GMT

{"_updated": "Mon, 12 Nov 2018 07:54:57 GMT", "_created": "Mon, 12 Nov 2018 07:54:57 GMT", "_etag": "9901a9d0f565369c2e49774aa3b3e3b4764f5aaf", "id": 2, "_links": {"self": {"title": "Node", "href": "nodes/2"}}, "_status": "OK"}

$ curl localhost:5000/nodes | python -m json.tool
{
    "_items": [
        {
            "created_by": 1,
            "updated_by": 1,
            "organization": [
                1
            ],
            "id": 1,
            "_updated": "Mon, 12 Nov 2018 07:54:55 GMT",
            "_created": "Mon, 12 Nov 2018 07:54:55 GMT",
            "_etag": "d4c403081de4d25f9005fa33ef10fcaa4f2b0063",
            "_links": {
                "self": {
                    "title": "Node",
                    "href": "nodes/1"
                }
            }
        },
        {
            "created_by": 1,
            "updated_by": 1,
            "organization": [
                1
            ],
            "id": 2,
            "_updated": "Mon, 12 Nov 2018 07:54:57 GMT",
            "_created": "Mon, 12 Nov 2018 07:54:57 GMT",
            "_etag": "9901a9d0f565369c2e49774aa3b3e3b4764f5aaf",
            "_links": {
                "self": {
                    "title": "Node",
                    "href": "nodes/2"
                }
            }
        }
    ],
    "_links": {
        "parent": {
            "title": "home",
            "href": "/"
        },
        "self": {
            "title": "nodes",
            "href": "nodes"
        }
    },
    "_meta": {
        "page": 1,
        "max_results": 25,
        "total": 2
    }
}

from eve-sqlalchemy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.