Skip to content

Latest commit

 

History

History
211 lines (164 loc) · 5 KB

File metadata and controls

211 lines (164 loc) · 5 KB

#API Object: marketplace.type

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

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

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

##Request URL

https://localhost:8443/marketplace/api/type

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 type in the system.

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

{  
    "title":"Title",
    "description":"This is a description"
}

#####Response Code: 201

#####Response

{  
    "id":65,
    "description":"This is a description",
    "title":"Title",
    "_links":{  
        "self":{  
            "href":"https://localhost:8443/marketplace/api/type/65"
        }
    }
}

#####Requirements none

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

{  
    "id":1,
    "title":"Widget",
    "description":"This is the widget description."
}

#####Response Code: 200

#####Response

{  
    "id":1,
    "description":"This is the widget description.",
    "title":"Widget",
    "_links":{  
        "self":{  
            "href":"https://localhost:8443/marketplace/api/type/1"
        }
    }
}

#####Requirements none

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

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

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

#####Response Code: 200

#####Response for one type id

{  
    "id":2,
    "description":"A web app",
    "title":"Web Application",
    "_links":{  
        "self":{  
            "href":"https://localhost:8443/marketplace/api/type/2"
        }
    }
}

#####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/type?offset=5

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




###DELETE### Use this call to remove a type from the system. #####Requirements https://localhost:8443/marketplace/api/type/{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 Type cannot be deleted. See if it is associated with a listing. If any listing is assigned to the type, you cannot delete that type.
403 User cannot create, edit, delete a type. Only administrators can create, edit, delete types.
400 Type cannot be created or updated. The type must include all required fields.
400 Type must have a unique name. If the type name is not unique, a validation error occurs when you try to save.