Closed pn279j closed 7 years ago
There's nothing to be found at the API root. You can find a list of available endpoints here: https://github.com/kasperisager/vanilla-api/wiki/Endpoints
Thanks Kasper! I was able to access the endpoints now! But while creating a user(/api/users), I am getting an error ""You must select at least one role."" . My request seems to be ok. I am giving role id as 8 so that the user can be created with "Member" role { "Name": "ae_test", "Email": "ae_test@att.com", "Password": "password123", "RoleID": 8 }
Any idea why this is happening?
No problem! As can be seen in the endpoint docs, RoleID
should be an array: https://github.com/kasperisager/vanilla-api/wiki/Endpoints#create-a-new-user
Got it! It gives me this error now: { "Code": 400, "Exception": "Could not instantiate mail function." }
I dont want to set up an email functionality to notify the user. It just want the user to be created silently.
Vanilla will try sending a mail regardless, and if no external mail provider is configured it will attempt using a built-in; in your case it seems there's none.
Hi Kasper! We have been able to make all of the features work with your api. Very impressive work. However, we were wondering if "liking" a comment or discussion is supported in your API. Thanks in advance!
Also, can we extend the API to upload images/videos for comments/discussions?
"Liking" as in YAGA? Either way, you can absolutely extend the API with mappings for any controller methods: https://github.com/kasperisager/vanilla-api/wiki/Extending
The API currently only supports JSON bodies, so controller methods that require form data (like uploads) however aren't supported.
Thanks Kasper. I am trying to update a discussion by calling PUT on /discussions/{id} and it is coming back with a 400 Bad Requuest. Here is my request: { "CountViews": "14" }
I am sending application/json in the headers and also sending the token as part of authentication. URL: {{domain}}/api/discussions/36?username={{username}}×tamp={{timestamp}}&token={{token}}
Any idea why this is happening? i want to increment the number of views of a discussion everytime it is clicked, hence the reason for updating the discussion.
You can only specify the parameters outlined in the documentation: https://github.com/kasperisager/vanilla-api/wiki/Endpoints#update-a-discussion
Thanks! I have another question. I am trying to get a user by its id using GET /api/users/{id} and it comes back with User not found. I am very sure that the id I am passing in the parameter is a valid user id. Any idea why this is happening? Error in the response: {"Code":404,"Exception":"User not found.","Class":"Gdn_UserException"}
How does the entire request look?
Here is the curl: curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: a218dc51-5544-c720-3179-1734696b4fba" "our server name/vanilla/api/users/2"
User id 2 exists because i was able to get it as part of /users call. Below is the snippet from /users response: { "UserID": "2", "Name": "vanilla-admin", "Photo": null, "Title": null, "Location": null, "About": null, "Email": "***", "ShowEmail": "0", "Gender": "u", "CountVisits": "6", "CountInvitations": "0", "CountNotifications": "0", "InviteUserID": null, "DiscoveryText": null, "Preferences": { "ShowAllCategories": true }, "DateSetInvitations": null, "DateOfBirth": "1975-09-16 00:00:00", "DateFirstVisit": "2016-06-09 19:03:00", "DateLastActive": "2016-06-24 19:09:31", "LastIPAddress": "135.70.46.12", "AllIPAddresses": "135.70.46.12,135.28.59.142,135.161.238.86,130.10.39.183,135.28.59.141,135.28.59.143,135.70.47.21", "DateInserted": "2016-06-09 19:03:00", "InsertIPAddress": "135.28.59.142", "DateUpdated": "2016-06-09 19:03:00", "UpdateIPAddress": null,
Nothing odd going on... Have you tried making the request authenticated?
The documentation says that the authentication is optional. I don't know the username of the user, so I cannot provide the authentication in the format: username=***×tamp=1466959407&token=db5292bfe31e6e4ccb04dd1a9951c8cecdfee832691a9833f23be4a6b5061643 In fact, I want to use this api to get the username by the user id : ) anyhow, I have a workaround through /users/summary API. I am getting all the users and looping through them to get the username for the matching user id. Thanks.
Hi,
while creating a new discussion, I am getting the following exception: {"Code":256,"Exception":"","Class":"Gdn_ErrorException"}
Here is my request: { "Name": "New Post from postman", "Body": "Body for new post", "CategoryID": 3 }
any idea why this exception occurs? My request is authenticated. thanks in advance.
Are you still experiencing this issue and if so could you open up a new one? Thanks!
I installed vanilla forums in my Windows machine. I am using wamp server with php v 5.4. I installed vanilla-api as an application and renamed it api . I am not able to access the API using /api endpoint. Any idea what might be the issue?