1

I am trying to use jquery to interact with posterous api , however I am unable to make sense of url and how parameters will be passed . I am using this :

$.ajax({ type: 'GET', url : 'http://posterous.com/api/2/users/me/sites', dataType:'xml', success: function(data,textStatus){ alert(data); }, error: function(xhr, ajaxOptions, thrownError){ alert('XHR : ' + xhr.status); alert("Error:"+thrownError); }

}); });

I am sure I will have to authenticate myself to access the sites , but posterous api has'nt given any examples on how to do that , does any one have idea ?

2 Answers 2

0

If they use Basic Auth you will need to provide a username and password (usually login and email respectively)

Look at the username and password arguments you can configure in the ajax call:

http://api.jquery.com/jQuery.ajax/

Sign up to request clarification or add additional context in comments.

1 Comment

herbert penito I tried this approach , but everytime I am getting XHR status of 0 when I send the request
0

you need to include an authorized token with every request. see this website to see how to get the token http://apidocs.posterous.com/pages/authentication then include the data property with your ajax call data:{api_token:YOUR_TOKEN}

2 Comments

crossman Maybe i am wrong in jquery then , because everytime I am getting xhr : 0 code <script> $(document).ready(function(){ $("a").click(function(){ $.ajax({ type: 'GET', url : 'posterous.com/api/2/auth/token', dataType:'xml', success: function(data,textStatus){ alert(data); }, error: function(xhr, ajaxOptions, thrownError){ alert('XHR : ' + xhr.status); alert("Error:"+thrownError); } }); }); }); </script> <a href="">Click on link</a> code
your dataType is set to XML the posterous api only returns JSON data for now.. try changing this to JSON and let me know

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.