Nested params with cURL?

前端 未结 2 1996
余生分开走
余生分开走 2020-12-29 05:00

I\'ve got an iPhone app requesting an API, and it uses a nested param structure to pass in a username and password to login.

In my Rails controller, I\'m successfull

相关标签:
2条回答
  • 2020-12-29 05:44

    Different frameworks may interpret http query params differently, but for rails you should be able to get away with the following:

    curl -d 'session[username]=name&session[password]=pwd' http://testurl/remote/v1/sessions
    
    0 讨论(0)
  • 2020-12-29 05:44

    I found this to work. Given a JSON blob like

    { "opts": {
        "finder": { 
          "cname":"superlatives"
        }
      }
    }
    
    
    
    curl -H "Content-Type: application/json" \
      -X POST \
      --data-binary '{"opts":{"finder":{"cname":"superlatives"}}}' \
      http://YOURSERVER.com/api/grams/one
    
    0 讨论(0)
提交回复
热议问题