Coder Social home page Coder Social logo

newsarticle's Introduction

NewsArticle

rsingh95/newsarticle_web (Docker Image)

NOTE: In our case the user is created for admin login via console and is admin user creation needs to take place via admin and so is the address.

For django admin login username-admin password-admin

Url that can be used via postman are:

1.a. To get the list of news articles that include only the headline 127.0.0.1:8000/blog/news/articles/ GET METHOD: Example json: [ { "id": "723f4b20-857a-449c-b73e-26cbc9e59513", "headline": "Coronavirus Lockdown" }, { "id": "1bde5a99-1140-4023-993a-3ec51ff5435f", "headline": "Coronavirus Lockdown V2" } ]

1.b. To create the list of news articles 127.0.0.1:8000/blog/news/articles/ POST METHOD: Input Json Example: { "headline": "Coronavirus Lockdown ", "content": "Detail content of articel", "published": true, "author_id":"17f204e1-bbae-4e6d-9fd1-fffaeeee296b", } Response JSON post success : { "article_id": "36b0209c-0378-4447-a991-65ca9a176d2e" } Similar headlines cant be used: 400 Bad request with below error message

{ "headline": [ "news article with this headline already exists." ] }

  1. Return details of a news article (headline & content) for a given id* 127.0.0.1:8000/blog/news/articles/pk/ here pk is the given id example url : 127.0.0.1:8000/blog/news/articles/723f4b20-857a-449c-b73e-26cbc9e59513/ GET METHOD with UUID: Example json: [{ "id": "723f4b20-857a-449c-b73e-26cbc9e59513", "headline": "Coronavirus Lockdown", "content": "Detail content of article", "author_email": "[email protected]", "author_id": "17f204e1-bbae-4e6d-9fd1-fffaeeee296b", "category_title": "Coronavirus Lockdown", "updated_at": "2021-01-20T20:26:16.387621Z" }]

  2. 127.0.0.1:8000/blog/news/articles/content/ return all the articel with details as for the above returns only one article but this route returns all the article

    GET METHOD to access all the articels present: Example Json: [ { "id": "723f4b20-857a-449c-b73e-26cbc9e59513", "headline": "Coronavirus Lockdown", "content": "Detail content of article", "author_email": "[email protected]", "author_id": "17f204e1-bbae-4e6d-9fd1-fffaeeee296b", "categories": "Coronavirus Lockdown", "updated_at": "2021-01-20T20:26:16.387621Z" }, { "id": "1bde5a99-1140-4023-993a-3ec51ff5435f", "headline": "Coronavirus Lockdown V2", "content": "Detail content of articel", "author_email": "[email protected]", "author_id": "17f204e1-bbae-4e6d-9fd1-fffaeeee296b", "categories": "Coronavirus Lockdown V2", "updated_at": "2021-01-20T20:02:42.465979Z" } ]

  3. User list 127.0.0.1:8000/blog/users/ returns all the user present

To access admin we use user as admin and password as admin.

Database used is postgresSql and all credential is in settings.py file.

To run the project migration is required and after that run the server then create user via admin whereas news article get and create method can be checked via postman it's all verified and working.

newsarticle's People

Contributors

rksingh95 avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.