Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
How can i get authentication by passing user name and apiKey
Asit Singh
Jun 7 2015 2:56 AM
482
Reply
How can i get authentication by passing user name and apiKey In restful webapi using json
Hi developers I am new in ajax and first time consuming web api .
This is my json object to authenticate a user . how can i pass this in ajax call to get the authenticate token please help me
POST /v2.0/tokens HTTP/1.1
User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
Host: identity.api.rackspacecloud.com
Accept: application/json
Content-Type: application/json
Content-Length: 54
{
"auth":
{
"RAX-KSKEY:apiKeyCredentials":
{
"username": (1)"jsmith",
"apiKey": (2)"aaaaa-bbbbb-ccccc-12345678"
}
}
}
</pre>
I am doing this but not able to consume please give me some solution
<pre lang="Javascript">
$.ajax({
url: 'https://identity.api.rackspacecloud.com/v2.0/tokens',
type: 'GET',
datatype:'application/json',
headers: { username: '
jsmith
', apiKey: '
aaaaa-bbbbb-ccccc-12345678'
},
success: function (data) {
alert('hi');
},
error: function (result)
{ alert('error:', result); }
});
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
how send textbox value listview with button to another page
What is Get and Post request in Asp.net?