iSheets API version 2 - iSheet admin - API - iSheet views - Add iSheet view
OVERVIEW
Add a new view to the iSheet
POST /api/3/isheets/admin/{isheetid}/views
Please include the Content-Type header as (application/xml) in your request.
Request body
send iSheet view object
Response
The methods returns a 200 http response in case of a successful request, otherwise an error object is returned.
Andrew Quinn thank you very much for highlighting the JSON format requirement, we will update that in the documentation
Thanks Imran Aziz, but I've worked out that the format in JSON is slightly different to that needed for an XML payload. I've updated the posts above to help others in the future. Sorry for any inconvenience. Andrew
Andrew Quinn thanks for raising the bug, I will escalate this issue internally with the technical team.
UPDATE:
For others experiencing a similar issue, the problem is that isheetview is not an accepted/required attribute in the JSON content. Thus an example of the correct format would be as below. For XML, isheetview is a requirement as it's the root node.
{
"title": "TEST123 - to delete",
"markasdefault": 0,
"emailview": 0,
"columns": {
"column": [
{
"columnid": 12131
},
{
"columnid": 12143
},
{
"columnid": 12138
}
]
}
"viewsortorder": {
"sortorder": [
{
"columnid": 12131,
"ordertype": "1",
"sortposition": "1"
}
]
},
"viewfilter": {
"row": [
{
"columnid": 12136,
"operatorid": 8,
"oprand": "Test Me",
"logicaltype": "1",
"sheetfiltervaluetypeid": "0"
}
]
}
}
Hi Imran Aziz, looks like there is still an issue with this endpoint when POSTing JSON:
Returns a 400 Bad Request with the following content:
Unrecognized field "isheetview" (Class com.os.api.dbo.isheet.ISheetView), not marked as ignorable at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@372e2de7; line: 1, column: 16] (through reference chain: com.os.api.dbo.isheet.ISheetView["isheetview"])
The JSON POSTed would be something like:
{
"isheetview": {
"title": "TEST123 - to delete",
"markasdefault": 0,
"emailview": 0,
"columns": {
"column": [
{
"columnid": 12131
},
{
"columnid": 12143
},
{
"columnid": 12138
}
]
}
}
}
This is a simple version, without any sort ordering, or filtering, specified.
Supplying the same view definition in XML does, however, create the view successfully.
Thanks, Andrew
FYI, make sure to add the Content-Type header in your request (application/xml) otherwise you will receive a (400) error 'Request resource or xml is not valid'
Comments
6 Comments