Open maelvls opened 3 years ago
Hi!
Looks like the ArticleUpdate in types.go does not match the latest payloads for CreateArticle and UpdateArticle of the Devto API reference.
ArticleUpdate
The error that appears when trying to update or create is a 422:
{"error":"article param must be a JSON object. You provided article as NilClass","status":422}
What devto-api-go currently produces:
{ "title": "Hello, World!", "published": true, "body_markdown": "Hello DEV, this is my first post", "tags": ["discuss", "help"], "series": "Hello series", "canonical_url": "https://example.com/blog/hello", "organization_id": 1234, "main_image": "foo.png", "description": "some description" }
What the API now requires:
{ "article": { "title": "Hello, World!", "published": true, "body_markdown": "Hello DEV, this is my first post", "tags": ["discuss", "help"], "series": "Hello series", "canonical_url": "https://example.com/blog/hello", "organization_id": 1234 } }
Diff:
diff --git a/Untitled-1.json b/Untitled-2.json index f1b7617..a636b7c 100644 --- a/Untitled-1.json +++ b/Untitled-2.json @@ -1,11 +1,11 @@ { - "title": "Hello, World!", - "published": true, - "body_markdown": "Hello DEV, this is my first post", - "tags": ["discuss", "help"], - "series": "Hello series", - "canonical_url": "https://example.com/blog/hello", - "organization_id": 1234, - "main_image": "foo.png", - "description": "some description" + "article": { + "title": "Hello, World!", + "published": true, + "body_markdown": "Hello DEV, this is my first post", + "tags": ["discuss", "help"], + "series": "Hello series", + "canonical_url": "https://example.com/blog/hello", + "organization_id": 1234 + } }
@VictorAvelar Do you think I could try to contribute a fix?
Sure man! thanks for opening the issue, I will be super happy to assist or answer any question you might have.
Hi!
Looks like the
ArticleUpdate
in types.go does not match the latest payloads for CreateArticle and UpdateArticle of the Devto API reference.The error that appears when trying to update or create is a 422:
What devto-api-go currently produces:
What the API now requires:
Diff:
@VictorAvelar Do you think I could try to contribute a fix?