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.
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×tamp=$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?
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.
Comments
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.
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 anid
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.
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
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×tamp=$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.
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.