Skip to content

Rest API Inconsistency #37803

Closed
Closed

Description

@fracklen

Description of Issue/Question

When using the /login endpoint of the rest server, rest_cherrypy accepts both a json object and an array of 1 object, containing the login credentials. Whereas rest_tornado only accepts a json object. Is this inconsistency by design? What is expected behaviour?

Setup

Set up rest_cherrypy or rest_tornado according to docs.

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

curl -si CHERRY_PY:8000/login \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -d '{
        "username": "saltuser",
        "password": "saltuser",
        "eauth": "auto"
    }'
=> OK

curl -si CHERRY_PY:8000/login \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -d '[{
        "username": "saltuser",
        "password": "saltuser",
        "eauth": "auto"
    }]'
=> OK

curl -si TORNADO:8000/login \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -d '{
        "username": "saltuser",
        "password": "saltuser",
        "eauth": "auto"
    }'
=> OK

curl -si TORNADO:8000/login \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -d '[{
        "username": "saltuser",
        "password": "saltuser",
        "eauth": "auto"
    }]'
=> 400 Invalid request

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
           Salt: 2016.3.4

Dependency Versions:
           cffi: 0.8.6
       cherrypy: 3.5.0
       dateutil: 2.2
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: 1.4.4
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: 2.10
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.6
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.6

Activity

  1. fracklen commented on Nov 21, 2016

    @fracklen
    ContributorAuthor
  2. Ch3LL commented on Nov 22, 2016

    @Ch3LL
    Contributor

    I believe this is another issue to be aware of in terms of feature parity between cherrypy and tornado as documented in this issue #26505 . According to that issue there are already some known differences between teh two salt-api's and this one seems to be one of those.

    ping @whiteinge Looks like this is another difference between the two. Would you like to add it to that list on that issue so we ensure this is included in the efforts to bring both api's up to par?

  3. added
    pending-discussion
    on Nov 22, 2016
  4. added this to the Blocked milestone on Nov 22, 2016
  5. whiteinge commented on Nov 22, 2016

    @whiteinge
    Contributor

    Thanks @Ch3LL. I added it to that list and linked this issue. It's a minor thing but compatibility for client libraries is important.

    @fracklen That switchover is not likely to happen soon. If you want to use rest_cherrypy with SSL CherryPy version 3.2.3 works across all distros and is a good version to install.

  6. Ch3LL commented on Nov 23, 2016

    @Ch3LL
    Contributor

    perfect thanks will approve this as a feature request towards feature parity between the two.

  7. added
    Feature
    and removed
    pending-discussion
    on Nov 23, 2016
  8. modified the milestones: Approved, Blocked on Nov 23, 2016
  9. stale commented on Jul 27, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

  10. mattp- commented on Oct 2, 2018

    @mattp-
    Contributor

    this isn't stale

  11. stale commented on Oct 2, 2018

    @stale

    Thank you for updating this issue. It is no longer marked as stale.

  12. stale commented on Jan 9, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureSalt-APIstale

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions