# Item Creation
# Create an item
The designated endpoint is specifically intended for the creation of items that can be commented on by users. This endpoint enables platform owners and administrators to easily add new items to their platform, such as articles, products, or posts, and allow users to provide comments and feedback. To utilize this endpoint, users can send a POST request with the name of the item they wish to create, The API will then validate the request and add the item to the platform, assigning it a unique identifier that can be used to retrieve the item's details.
#
# Request
- HTTP Method:
POST
- accept :
application/json
- Content Type :
application/json
- Authorization :
bearer userjwt
- URL:
https://comments-api-production.up.railway.app/items/create-item
# Body Parameters
Property | Type | Required | Description |
---|---|---|---|
name | string | true | The name of the item entering the database |
# Request example
curl -X POST \
'https://comments-api-production.up.railway.app/items/create-item' \
-H 'accept : application/json' \
-H 'Content-Type : application/json' \
-H 'Authorization : bearer userjwt' \
-d '{
"name" : "Konoha Headband"
}'
# Expected Responses:
# Item Created
You have successfully created an item
{
"statusCode":201,
"responseValue":{
"message":"Item Created Successfully",
"itemId":22}
}
# Other Responses:
# Unauthorised Access
You are not allowed to create an item
{
"statusCode":401,
"message":"Unauthorized"}
# Playground
Method: POST
URL: https://comments-api-production.up.railway.app/items/create-item
Headers:
Key | Value |
---|---|
accept | |
Content-Type | |
Authorization |