Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

POST request with json data #248

Open
drupalsr opened this issue Oct 12, 2018 · 1 comment
Open

POST request with json data #248

drupalsr opened this issue Oct 12, 2018 · 1 comment

Comments

@drupalsr
Copy link

drupalsr commented Oct 12, 2018

I am integrating the authentication/ login screen using Jasoneete.

"https://www.jasonbase.com/things/1xWK.json"

Trying to set the headers with "content-type": "application/json" but unable to update the same, by default it is "application/x-www-form-urlencoded".

Need to send json data using POST request

Below is my code snippet

"text": "Login",
"action": {
"type": "$network.request",
"options": {
"url": "https:///employer_login.json",
"method": "post",
"data": {
"name": "{{$get.email}}",
"pass": "{{$get.password}}"
},
"data_type": "json",
"content_type": "json"
},
"success": {
"type": "$util.banner",
"options": {
"title": "{{$jason.status.message}}"
},
"success": {
"type": "$render"
},
"error": {
"type": "$util.alert",
"options": {
"title": "Error setting global"
}
}
},
"error": {
"type": "$util.alert",
"options": {
"title": "Error",
"description": "Email or Password is incorrect"
}
},

@scriptmaster
Copy link

This is a defect in documentation.

content_type is used only in header. The _request function needs a big refactoring...

Check out here https://github.com/Jasonette/JASONETTE-Android/blob/develop/app/src/main/java/com/jasonette/seed/Action/JasonNetworkAction.java#L120

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants