I have tried to use PUT /t/:id to update topic content with no effect.
https://github.com/discourse/discourse_api/blob/master/lib/discourse_api/api/topics.rb
Seems there is no way to update the content using API. Am I missing anything?
You need to provide the topic slug like this: PUT /t/:slug/:id as documented here: http://docs.discourse.org/#tag/Topics%2Fpaths%2F~1t~1%7Bslug%7D~1%7Bid%7D.json%2Fput
The /t/:id endpoint only works if you issue a GET request as documented here: http://docs.discourse.org/#tag/Topics%2Fpaths%2F~1t~1%7Bid%7D.json%2Fget which I guess is not what you want.
The solution
In Discourse land, a topic it's just a bunch of posts. A topic has no
body, the first post of the topic is the body.
So, what you do is this:
GET /t/:id with your topic id
Parse the post_stream and get the first post, or whichever you need. Get the ID
PUT /posts/:id and use the ID you just got, and provide post[raw] in the body.
Please, see this discussion: https://meta.discourse.org/t/updating-topic-body-via-the-api/61220/5
Related
I need to get the comment content via code or script, and I found this doc and try it, but now, the latest issue is I cannot get the comment ID. Could you please help us to get the latest comment ID or list all comment ID via task ID. Thx.
What I tried:
API: https://your-domain.atlassian.net/rest/api/2/comment/{commentId}/properties
Java code:
HttpResponse<JsonNode> response = Unirest.get("https://your-domain.atlassian.net/rest/api/2/comment/{commentId}/properties")
.basicAuth("email#example.com", "<api_token>")
.header("Accept", "application/json")
.asJson();
System.out.println(response.getBody());
I have tried this api via postman, and it works.
You can find it from the issue id or key.
First, get the issue's comments via:
GET /rest/api/2/issue/{issueIdOrKey}/comment
Then, find the comment id from here and call
GET /rest/api/2/comment/{commentId}/properties
Update
The first API could get task details and then we need to use below API to get one of the comment.
rest/api/2/issue/{issueIdOrKey}/comment/{commentId}
I need to pass correlation Id into the IHttpProvider to let them log it for debugging purpose. How should I do that? Thanks!
We don't have a great solution for you to provide your own correlation Id today, however it something that we are working on. Requests that are made to Graph will get assigned a request id and you should be able to see that in the response headers. You could add your own using header using .Request(options).
I have a reddit post link here:
https://www.reddit.com/r/dankmemes/comments/6m5k0o/teehee/
I wish to access the data of this post throught the redditkit API.
http://www.rubydoc.info/gems/redditkit/
I have tried countless times and the docs don't make too much sense to me. Can someone help show how to do this through the ruby console? Or even an implementation of this in rails would be really helpful!
Looking at the #comment method on the gem, it takes a comment_full_name and performs a GET to api/info.json with that parameter as an id (seen by viewing the source for that method). If we look at the reddit api for api/info the id parameter is a full name for the object with a link to what a full name is.
Following that link, a full name for a comment is
Fullnames start with the type prefix for the object's type, followed by the thing's unique ID in base 36.
and
type prefixes
t1_ Comment
So now we know the comment_full_name should be t1_#{comment's unique id} which appears to be 6m5k0o. Here, I'm unsure if that's already base36 or if they want you to convert that into base36 before passing it. Without seeing what all you've tried, I would say
client = RedditKit::Client.new 'username', 'password'
client.comment("t1_6m5k0o")
and if that doesn't work
client.comment("t1_#{'6m5k0o' base36 encoded}")
For questions like this, it would be nice to see some of your code and what you tried/results they gave. For all I know, you've already tried this and have a reason it didn't work for you.
I would test this out for you, but I don't have a reddit account for the gem to sign in with, this is just my guess glancing at the documentation.
I'm honestly stumped as to how I could do this. I've been searching and trying out different methods for the past day or so and none have worked. What I'm basically trying to do is store comments for a post (Each row represents a post). I've been reading through the Parse documentation and have tried to implement some of the things that they have there into my code in order to achieve this, but that hasn't worked out either. If anybody could help me out, I'd be extremely greatful.
This exact task is the example provided in the documentation.
http://docs.parseplatform.org/ios/guide/#relational-data
You need to create a new class called "Comments" and then refrence its parent post as one of it's columns.
Trying to use the Attask API to post a new issue to a project. It works without posting cutom data. This works fine:
https://ourcompany.attask-ondemand.com/attask/api/task?projectID=&&status=NEW&priority=2&name=Test%20Project%20FOOBAR&description=test&estCompletionDate=2014-03-28T09:00:00:000-0700
However, I'm unable to post custom data. The url we use:
https://ourcompany.attask-ondemand.com/attask/api/task?projectID=&&status=NEW&priority=2&name=Test%20Project%20FOOBAR&description=test&estCompletionDate=2014-03-28T09:00:00:000-0700&DE%3ACUSTOMDATAFIELD=BLAH
The error we receive is:
{"error":{"class":"com.attask.common.InvalidParameterException","message":"category cannot be null","title":null,"msgKey":"exception.attask","attributes":[""],"code":0}}
I do not understand what it is asking. The Attask API documentation is not helpful here. What am I missing in my URL?
Thank you!
You need to also set the categoryID to the category which has the custom data field.
https://ourcompany.attask-ondemand.com/attask/api/task?projectID=&&status=NEW&priority=2&name=Test%20Project%20FOOBAR&description=test&estCompletionDate=2014-03-28T09:00:00:000-0700&DE%3ACUSTOMDATAFIELD=BLAH&categoryID=XXXX
This is also assuming that you are doing a POST action.