Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Vanilla API

13»

Comments

  • KasperKasper Vanilla Staff

    Gotcha! So everything's working now?

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • @kasper, Yes. Except the error 405 "method not allowed". Thanks a lot.

  • KasperKasper Vanilla Staff

    Awesome, glad to hear! Like I mentioned earlier, whenever you get a 405 it's because you're trying to ping an endpoint with a method is doesn't support.

    Also, when referencing IDs, you shouldn't do it like this :26 – the colon seen in the docs (:id) just means that it's a variable, you shouldn't actually include it. Postman supports these kinds of variables, so if you do :id in a URL (like in the collection I made), you should be able to see an id field in the "URL Params" section that you can then fill out.

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • @kasper, Thanks for that information.

  • @kasper, Everything now works perfectly. I can now create new comment for existing discussion using postman client. Thanks for your help.

  • KasperKasper Vanilla Staff

    That's great to hear, glad it worked out in the end – you're very welcome!

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • lkj897lkj897 New
    edited August 2014

    After many hours, I finally got this to work, but I can only perform GET operations. How do I do POST? For example, if I have the following code adapted from georgegijo:

    $frequest = "?username=$username&email=$email&timestamp=$dtimestamp&token=$Token"; $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,'http://mysite.com/vanilla-master/api/discussions/2'.$frequest); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_handle, CURLOPT_HTTPGET, 1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)){ print "Nothing returned from url.<p>"; } else{ print $buffer; }

    How do I turn that into a POST to add a discussion, for instance?

  • @lkj897‌ Welcome to the community!

    When I was working with the API for a client, I created a PHP script ran inside the Vanilla framework for testing. I set the expiration date to 24 hours so I would only have to do this once a day.

    $Timestamp = time();
    $Data = array(
      'username'  => 'johndoe',
      'email'     => 'example@mail.com',
      'timestamp' => time()
    );
    
    $Token = APIAuth::generateSignature($Data);
    
    decho($Timestamp, 'Timestamp: ');
    decho($Token, 'Token: ');
    

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.