Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4669023yThis: https://devrantapi.docs.apiary.io/
And so you don't run into any problems: https://github.com/C0D4-101/... -
jirubizu763y@C0D4 so I have been using that. However, the posting rants seem to be broken. Even using the built in console. I am unable to post rants via the API.
-
jirubizu763y@C0D4 I am writing an API for C#
```
string url = $"devrant/rants?app=3&rant={rant}&type={type}" +
$"&token_id={DevrantAuth.AuthData.Id}&token_key={DevrantAuth.AuthData.Key}&user_id={DevrantAuth.AuthData.UserId}";
return _httpClient.Post<PostRantResponse>(url) ?? new PostRantResponse();
``` -
C0D4669023yThe {rant} is url encoded ?
And are you setting the content type in the headers?
'Content-Type': 'application/x-form-urlencoded' -
jirubizu763y@C0D4 Yeah
This is the response I get from the API,
{"success":false,"error":"Invalid app id specified."} -
jirubizu763y@C0D4 So i have the following atm,
public T? PostXForm<T>(string url, HttpContent content)
{
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
HttpResponseMessage result = _httpClient.PostAsync(url,null).Result;
return JsonConvert.DeserializeObject<T>(result.Content.ReadAsStringAsync().Result);
}
and
HttpContent content = new FormUrlEncodedContent(
new List<KeyValuePair<string, string>> {
new("app", "3"),
new("rant", HttpUtility.UrlEncode(rant)),
new("type", type.ToString()),
new("token_id", DevrantAuth.AuthData.Id.ToString()),
new("token_key", DevrantAuth.AuthData.Key),
new("user_id", DevrantAuth.AuthData.UserId.ToString())
}
);
return _httpClient.PostXForm<PostRantResponse>("devrant/rants", content) ?? new PostRantResponse();
But still no go
Related Rants
Is there up-to-date API documentation for devrant? I am stuck on the posting API calls, especially on what data is required.
question
devrant
api