Skip to content

Latest commit

 

History

History
209 lines (164 loc) · 5.18 KB

File metadata and controls

209 lines (164 loc) · 5.18 KB

#API Object: marketplace.category

##Definition Use the /category API to create, update, read or delete a category or list of categories in the system.

##Resource Information The following properties appear in the Category JSON:

Parameter Description
id The numerical ID associated with the category object.
description Information about the category that is provided by an administrator.
title The name of the category.

##Request URL

https://localhost:8443/marketplace/api/category

This placeholder URL will vary depending upon your deployment. Be mindful that https://localhost:8443/marketplace is an example "base/context/domain" where your WAR is deployed.

##Request Methods POST, PUT, GET, DELETE
Each method will be explained in the following sections:

###POST Use this call to create a category in the system.

#####Request https://localhost:8443/marketplace/api/category

{  
    "title":"News",
    "description":"This is the News category."
}

#####Response Code: 201

#####Response

{  
    "id":65,
    "description":"This is the News category.",
    "title":"News",
    "_links":{  
        "self":{  
            "href":"https://localhost:8443/marketplace/api/category/65"
        }
    }
}

#####Requirements none

###PUT### Use this call to update a category in the system. #####Request https://localhost:8443/marketplace/api/category/{id}

{  
    "id":65,
    "title":"${News}",
    "description":"This is the News category."
}

#####Response Code: 200

#####Response

{  
    "id":65,
    "description":"This is the News category.",
    "title":"News",
    "_links":{  
        "self":{  
            "href":"https://localhost:8443/marketplace/api/category/65"
        }
    }
}

#####Requirements none

###GET### Use this call to read or view a category or all the categories in the system. #####Request If you want to see a list of all the categories in the system, enter: https://localhost:8443/marketplace/api/category/

However, to view metadata about only one category, enter: https://localhost:8443/marketplace/api/category/{id}

Marketplace returns the representation of the category that matches the{id}, as shown in the Response for one category id.

#####Response Code: 200

#####Response for one category id

{  
    "id":65,
    "description":"This is the News category.",
    "title":"News",
    "_links":{  
        "self":{  
            "href":"https://localhost:8443/marketplace/api/category/65"
        }
    }
}

#####Requirements none #####Optional Parameters If you want to limit the responses, for example, only return 5, use Optional Parameters which are included in the code as @QueryParam:

offset--an integer offset
Example: https://localhost:8443/marketplace/api/category?offset=5

max--maximum number of category ids your call will return Example: https://localhost:8443/marketplace/api/category?max=5




###DELETE### Use this call to remove a category from the system. #####Requirements https://localhost:8443/marketplace/api/category/{id}

#####Response Code: 204

#####Response no content

#####Requirements none



###Possible Errors

This table lists common errors. Other errors may occur but these are the most likely:

Error
Code
Error Troubleshooting
400 Category cannot be deleted. See if it is associated with a listing. If any listing is assigned to the category, you cannot delete that category.
403 User cannot create, edit, delete a category. Only administrators can create, edit, delete categories.
400 Categories cannot be created or updated. The category must include all required fields.
400 Category must have a unique name. If the category name is not unique, a validation error occurs when you try to save.