зеркало из https://github.com/nextcloud/forms.git
Update API version to v2.4
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
This commit is contained in:
Родитель
29072fa97f
Коммит
508a939a5a
|
@ -117,7 +117,7 @@ return [
|
|||
'url' => '/api/{apiVersion}/form/update',
|
||||
'verb' => 'POST',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v2(\.[1-3])?'
|
||||
'apiVersion' => 'v2(\.[1-4])?'
|
||||
]
|
||||
],
|
||||
[
|
||||
|
@ -176,7 +176,7 @@ return [
|
|||
'url' => '/api/{apiVersion}/question/update',
|
||||
'verb' => 'POST',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v2(\.[1-3])?'
|
||||
'apiVersion' => 'v2(\.[1-4])?'
|
||||
]
|
||||
],
|
||||
[
|
||||
|
@ -193,7 +193,7 @@ return [
|
|||
'url' => '/api/{apiVersion}/question/reorder',
|
||||
'verb' => 'POST',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v2(\.[1-3])?'
|
||||
'apiVersion' => 'v2(\.[1-4])?'
|
||||
]
|
||||
],
|
||||
[
|
||||
|
@ -236,7 +236,7 @@ return [
|
|||
'url' => '/api/{apiVersion}/option/update',
|
||||
'verb' => 'POST',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v2(\.[1-3])?'
|
||||
'apiVersion' => 'v2(\.[1-4])?'
|
||||
]
|
||||
],
|
||||
[
|
||||
|
@ -279,7 +279,7 @@ return [
|
|||
'url' => '/api/{apiVersion}/share/update',
|
||||
'verb' => 'POST',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v2.1'
|
||||
'apiVersion' => 'v2\.[1-4]'
|
||||
]
|
||||
],
|
||||
[
|
||||
|
|
48
docs/API.md
48
docs/API.md
|
@ -21,7 +21,7 @@ This file contains the API-Documentation. For more information on the returned D
|
|||
```
|
||||
## API changes
|
||||
### Deprecation info
|
||||
- Starting with API v2.2 all endpoints that update data will use PUT as method. POST is now deprecated and will be removed in API v3
|
||||
- Starting with API v2.2 all endpoints that update data will use PATCH/PUT as method. POST is now deprecated and will be removed in API v3
|
||||
|
||||
### Breaking Changes on API v2
|
||||
- The `mandatory` property of questions has been removed. It is replaced by `isRequired`.
|
||||
|
@ -42,7 +42,7 @@ This file contains the API-Documentation. For more information on the returned D
|
|||
## Form Endpoints
|
||||
### List owned Forms
|
||||
Returns condensed objects of all Forms beeing owned by the authenticated user.
|
||||
- Endpoint: `/api/v2.2/forms`
|
||||
- Endpoint: `/api/v2.4/forms`
|
||||
- Method: `GET`
|
||||
- Parameters: None
|
||||
- Response: Array of condensed Form Objects, sorted as newest first.
|
||||
|
@ -77,7 +77,7 @@ Returns condensed objects of all Forms beeing owned by the authenticated user.
|
|||
|
||||
### List shared Forms
|
||||
Returns condensed objects of all Forms, that are shared & shown to the authenticated user and that have not expired yet.
|
||||
- Endpoint: `/api/v2.2/shared_forms`
|
||||
- Endpoint: `/api/v2.4/shared_forms`
|
||||
- Method: `GET`
|
||||
- Parameters: None
|
||||
- Response: Array of condensed Form Objects, sorted as newest first, similar to [List owned Forms](#list-owned-forms).
|
||||
|
@ -87,7 +87,7 @@ See above, 'List owned forms'
|
|||
|
||||
### Get a partial Form
|
||||
Returns a single partial form object, corresponding to owned/shared form-listings.
|
||||
- Endpoint: `/api/v2.2/partial_form/{hash}`
|
||||
- Endpoint: `/api/v2.4/partial_form/{hash}`
|
||||
- Method: `GET`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|
@ -108,7 +108,7 @@ Returns a single partial form object, corresponding to owned/shared form-listing
|
|||
```
|
||||
|
||||
### Create a new Form
|
||||
- Endpoint: `/api/v2.2/form`
|
||||
- Endpoint: `/api/v2.4/form`
|
||||
- Method: `POST`
|
||||
- Parameters: None
|
||||
- Response: The new form object, similar to requesting an existing form.
|
||||
|
@ -207,7 +207,7 @@ Returns the full-depth object of the requested form (without submissions).
|
|||
|
||||
### Clone a form
|
||||
Creates a clone of a form (without submissions).
|
||||
- Endpoint: `/api/v2.2/form/clone/{id}`
|
||||
- Endpoint: `/api/v2.4/form/clone/{id}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -220,7 +220,7 @@ See section 'Request full data of a form'.
|
|||
|
||||
### Update form properties
|
||||
Update a single or multiple properties of a form-object. Concerns **only** the Form-Object, properties of Questions, Options and Submissions, as well as their creation or deletion, are handled separately.
|
||||
- Endpoint: `/api/v2.2/form/update`
|
||||
- Endpoint: `/api/v2.4/form/update`
|
||||
- Method: `PATCH`
|
||||
- *Method: `POST` deprecated*
|
||||
- Parameters:
|
||||
|
@ -235,7 +235,7 @@ Update a single or multiple properties of a form-object. Concerns **only** the F
|
|||
```
|
||||
### Transfer form ownership
|
||||
Transfer the ownership of a form to another user
|
||||
- Endpoint: `/api/v2.2/form/transfer`
|
||||
- Endpoint: `/api/v2.4/form/transfer`
|
||||
- Method: `POST`
|
||||
- Parameters:
|
||||
| Parameter | Type | Description |
|
||||
|
@ -249,7 +249,7 @@ Transfer the ownership of a form to another user
|
|||
```
|
||||
|
||||
### Delete a form
|
||||
- Endpoint: `/api/v2.2/form/{id}`
|
||||
- Endpoint: `/api/v2.4/form/{id}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -295,7 +295,7 @@ Transfer the ownership of a form to another user
|
|||
Contains only manipulative question-endpoints. To retrieve questions, request the full form data.
|
||||
|
||||
### Create a new question
|
||||
- Endpoint: `/api/v2.2/question`
|
||||
- Endpoint: `/api/v2.4/question`
|
||||
- Method: `POST`
|
||||
- Parameters:
|
||||
| Parameter | Type | Optional | Description |
|
||||
|
@ -320,7 +320,7 @@ Contains only manipulative question-endpoints. To retrieve questions, request th
|
|||
|
||||
### Update question properties
|
||||
Update a single or multiple properties of a question-object.
|
||||
- Endpoint: `/api/v2.2/question/update`
|
||||
- Endpoint: `/api/v2.4/question/update`
|
||||
- Method: `PATCH`
|
||||
- *Method: `POST` deprecated*
|
||||
- Parameters:
|
||||
|
@ -336,7 +336,7 @@ Update a single or multiple properties of a question-object.
|
|||
|
||||
### Reorder questions
|
||||
Reorders all Questions of a single form
|
||||
- Endpoint: `/api/v2.2/question/reorder`
|
||||
- Endpoint: `/api/v2.4/question/reorder`
|
||||
- Method: `PUT`
|
||||
- *Method: `POST` deprecated*
|
||||
- Parameters:
|
||||
|
@ -361,7 +361,7 @@ Reorders all Questions of a single form
|
|||
```
|
||||
|
||||
### Delete a question
|
||||
- Endpoint: `/api/v2.2/question/{id}`
|
||||
- Endpoint: `/api/v2.4/question/{id}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -374,7 +374,7 @@ Reorders all Questions of a single form
|
|||
|
||||
### Clone a question
|
||||
Creates a clone of a question with all its options.
|
||||
- Endpoint: `/api/v2.3/question/clone/{id}`
|
||||
- Endpoint: `/api/v2.4/question/clone/{id}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -389,7 +389,7 @@ See section 'Create a new question'.
|
|||
Contains only manipulative question-endpoints. To retrieve options, request the full form data.
|
||||
|
||||
### Create a new Option
|
||||
- Endpoint: `/api/v2.2/option`
|
||||
- Endpoint: `/api/v2.4/option`
|
||||
- Method: `POST`
|
||||
- Parameters:
|
||||
| Parameter | Type | Description |
|
||||
|
@ -407,7 +407,7 @@ Contains only manipulative question-endpoints. To retrieve options, request the
|
|||
|
||||
### Update option properties
|
||||
Update a single or all properties of an option-object
|
||||
- Endpoint: `/api/v2.2/option/update`
|
||||
- Endpoint: `/api/v2.4/option/update`
|
||||
- Method: `PATCH`
|
||||
- *Method: `POST` deprecated*
|
||||
- Parameters:
|
||||
|
@ -422,7 +422,7 @@ Update a single or all properties of an option-object
|
|||
```
|
||||
|
||||
### Delete an option
|
||||
- Endpoint: `/api/v2.2/option/{id}`
|
||||
- Endpoint: `/api/v2.4/option/{id}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -435,7 +435,7 @@ Update a single or all properties of an option-object
|
|||
|
||||
## Sharing Endpoints
|
||||
### Add a new Share
|
||||
- Endpoint: `/api/v2.2/share`
|
||||
- Endpoint: `/api/v2.4/share`
|
||||
- Method: `POST`
|
||||
- Parameters:
|
||||
| Parameter | Type | Description |
|
||||
|
@ -457,7 +457,7 @@ Update a single or all properties of an option-object
|
|||
```
|
||||
|
||||
### Delete a Share
|
||||
- Endpoint: `/api/v2.2/share/{id}`
|
||||
- Endpoint: `/api/v2.4/share/{id}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -469,7 +469,7 @@ Update a single or all properties of an option-object
|
|||
```
|
||||
|
||||
### Update a Share
|
||||
- Endpoint: `/api/v2.2/share/update`
|
||||
- Endpoint: `/api/v2.4/share/update`
|
||||
- Parameters:
|
||||
| Parameter | Type | Description |
|
||||
|------------------|----------|-------------|
|
||||
|
@ -487,7 +487,7 @@ Update a single or all properties of an option-object
|
|||
## Submission Endpoints
|
||||
### Get Form Submissions
|
||||
Get all Submissions to a Form
|
||||
- Endpoint: `/api/v2.2/submissions/{hash}`
|
||||
- Endpoint: `/api/v2.4/submissions/{hash}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -614,7 +614,7 @@ Creates a csv file and stores it to the cloud, resp. Files-App.
|
|||
|
||||
### Delete Submissions
|
||||
Delete all Submissions to a form
|
||||
- Endpoint: `/api/v2.2/submissions/{formId}`
|
||||
- Endpoint: `/api/v2.4/submissions/{formId}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
@ -627,7 +627,7 @@ Delete all Submissions to a form
|
|||
|
||||
### Insert a Submission
|
||||
Store Submission to Database
|
||||
- Endpoint: `/api/v2.2/submission/insert`
|
||||
- Endpoint: `/api/v2.4/submission/insert`
|
||||
- Method: `POST`
|
||||
- Parameters:
|
||||
| Parameter | Type | Description |
|
||||
|
@ -649,7 +649,7 @@ Store Submission to Database
|
|||
- Response: **Status-Code OK**.
|
||||
|
||||
### Delete a single Submission
|
||||
- Endpoint: `/api/v2.2/submission/{id}`
|
||||
- Endpoint: `/api/v2.4/submission/{id}`
|
||||
- Url-Parameter:
|
||||
| Parameter | Type | Description |
|
||||
|-----------|---------|-------------|
|
||||
|
|
|
@ -275,7 +275,7 @@ export default {
|
|||
|
||||
// Load Owned forms
|
||||
try {
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.2/forms'))
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.4/forms'))
|
||||
this.forms = OcsResponse2Data(response)
|
||||
} catch (error) {
|
||||
logger.error('Error while loading owned forms list', { error })
|
||||
|
@ -284,7 +284,7 @@ export default {
|
|||
|
||||
// Load shared forms
|
||||
try {
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.2/shared_forms'))
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.4/shared_forms'))
|
||||
this.sharedForms = OcsResponse2Data(response)
|
||||
} catch (error) {
|
||||
logger.error('Error while loading shared forms list', { error })
|
||||
|
@ -303,7 +303,7 @@ export default {
|
|||
this.loading = true
|
||||
|
||||
try {
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.2/partial_form/{hash}', { hash }))
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.4/partial_form/{hash}', { hash }))
|
||||
const form = OcsResponse2Data(response)
|
||||
|
||||
// If the user has (at least) submission-permissions, add it to the shared forms
|
||||
|
@ -324,7 +324,7 @@ export default {
|
|||
async onNewForm() {
|
||||
try {
|
||||
// Request a new empty form
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.2/form'))
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/form'))
|
||||
const newForm = OcsResponse2Data(response)
|
||||
this.forms.unshift(newForm)
|
||||
this.$router.push({ name: 'edit', params: { hash: newForm.hash } })
|
||||
|
@ -342,7 +342,7 @@ export default {
|
|||
*/
|
||||
async onCloneForm(id) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.2/form/clone/{id}', { id }))
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/form/clone/{id}', { id }))
|
||||
const newForm = OcsResponse2Data(response)
|
||||
this.forms.unshift(newForm)
|
||||
this.$router.push({ name: 'edit', params: { hash: newForm.hash } })
|
||||
|
|
|
@ -235,7 +235,7 @@ export default {
|
|||
async onDeleteForm() {
|
||||
this.loading = true
|
||||
try {
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.2/form/{id}', { id: this.form.id }))
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.4/form/{id}', { id: this.form.id }))
|
||||
this.$emit('delete', this.form.id)
|
||||
} catch (error) {
|
||||
logger.error(`Error while deleting ${this.formTitle}`, { error: error.response })
|
||||
|
|
|
@ -166,7 +166,7 @@ export default {
|
|||
*/
|
||||
async createAnswer(answer) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.2/option'), {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/option'), {
|
||||
questionId: answer.questionId,
|
||||
text: answer.text,
|
||||
})
|
||||
|
@ -194,7 +194,7 @@ export default {
|
|||
*/
|
||||
async updateAnswer(answer) {
|
||||
try {
|
||||
await axios.patch(generateOcsUrl('apps/forms/api/v2.2/option/update'), {
|
||||
await axios.patch(generateOcsUrl('apps/forms/api/v2.4/option/update'), {
|
||||
id: this.answer.id,
|
||||
keyValuePairs: {
|
||||
text: answer.text,
|
||||
|
|
|
@ -290,7 +290,7 @@ export default {
|
|||
|
||||
if (!option.local) {
|
||||
// let's not await, deleting in background
|
||||
axios.delete(generateOcsUrl('apps/forms/api/v2.2/option/{id}', { id: option.id }))
|
||||
axios.delete(generateOcsUrl('apps/forms/api/v2.4/option/{id}', { id: option.id }))
|
||||
.catch(error => {
|
||||
logger.error('Error while deleting an option', { option, error })
|
||||
showError(t('forms', 'There was an issue deleting this option'))
|
||||
|
|
|
@ -439,7 +439,7 @@ export default {
|
|||
|
||||
if (!option.local) {
|
||||
// let's not await, deleting in background
|
||||
axios.delete(generateOcsUrl('apps/forms/api/v2.2/option/{id}', { id: option.id }))
|
||||
axios.delete(generateOcsUrl('apps/forms/api/v2.4/option/{id}', { id: option.id }))
|
||||
.catch(error => {
|
||||
logger.error('Error while deleting an option', { error, option })
|
||||
showError(t('forms', 'There was an issue deleting this option'))
|
||||
|
|
|
@ -240,7 +240,7 @@ export default {
|
|||
this.isLoading = true
|
||||
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.2/share'), {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/share'), {
|
||||
formId: this.form.id,
|
||||
shareType: newShare.shareType,
|
||||
shareWith: newShare.shareWith,
|
||||
|
@ -262,7 +262,7 @@ export default {
|
|||
this.isLoading = true
|
||||
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.2/share'), {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/share'), {
|
||||
formId: this.form.id,
|
||||
shareType: this.SHARE_TYPES.SHARE_TYPE_LINK,
|
||||
})
|
||||
|
@ -288,7 +288,7 @@ export default {
|
|||
this.isLoading = true
|
||||
|
||||
try {
|
||||
const response = await axios.patch(generateOcsUrl('apps/forms/api/v2.2/share/update'), {
|
||||
const response = await axios.patch(generateOcsUrl('apps/forms/api/v2.4/share/update'), {
|
||||
id: updatedShare.id,
|
||||
keyValuePairs: {
|
||||
permissions: updatedShare.permissions,
|
||||
|
@ -316,7 +316,7 @@ export default {
|
|||
this.isLoading = true
|
||||
|
||||
try {
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.2/share/{id}', {
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.4/share/{id}', {
|
||||
id: share.id,
|
||||
}))
|
||||
this.$emit('remove-share', share)
|
||||
|
|
|
@ -143,7 +143,7 @@ export default {
|
|||
if (this.form.id && this.selected.shareWith) {
|
||||
try {
|
||||
emit('forms:last-updated:set', this.form.id)
|
||||
await axios.post(generateOcsUrl('apps/forms/api/v2.2/form/transfer'), {
|
||||
await axios.post(generateOcsUrl('apps/forms/api/v2.4/form/transfer'), {
|
||||
formId: this.form.id,
|
||||
uid: this.selected.shareWith,
|
||||
})
|
||||
|
|
|
@ -340,7 +340,7 @@ export default {
|
|||
async saveQuestionProperty(key, value) {
|
||||
try {
|
||||
// TODO: add loading status feedback ?
|
||||
await axios.patch(generateOcsUrl('apps/forms/api/v2.2/question/update'), {
|
||||
await axios.patch(generateOcsUrl('apps/forms/api/v2.4/question/update'), {
|
||||
id: this.id,
|
||||
keyValuePairs: {
|
||||
[key]: value,
|
||||
|
|
|
@ -127,7 +127,7 @@ export default {
|
|||
this.cancelFetchFullForm = cancel
|
||||
|
||||
try {
|
||||
const response = await request(generateOcsUrl('apps/forms/api/v2.2/form/{id}', { id }))
|
||||
const response = await request(generateOcsUrl('apps/forms/api/v2.4/form/{id}', { id }))
|
||||
this.$emit('update:form', OcsResponse2Data(response))
|
||||
this.isLoadingForm = false
|
||||
} catch (error) {
|
||||
|
@ -147,7 +147,7 @@ export default {
|
|||
async saveFormProperty(key) {
|
||||
try {
|
||||
// TODO: add loading status feedback ?
|
||||
await axios.patch(generateOcsUrl('apps/forms/api/v2.2/form/update'), {
|
||||
await axios.patch(generateOcsUrl('apps/forms/api/v2.4/form/update'), {
|
||||
id: this.form.id,
|
||||
keyValuePairs: {
|
||||
[key]: this.form[key],
|
||||
|
|
|
@ -343,7 +343,7 @@ export default {
|
|||
this.isLoadingQuestions = true
|
||||
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.2/question'), {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/question'), {
|
||||
formId: this.form.id,
|
||||
type,
|
||||
text,
|
||||
|
@ -383,7 +383,7 @@ export default {
|
|||
this.isLoadingQuestions = true
|
||||
|
||||
try {
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.2/question/{id}', { id }))
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.4/question/{id}', { id }))
|
||||
const index = this.form.questions.findIndex(search => search.id === id)
|
||||
this.form.questions.splice(index, 1)
|
||||
emit('forms:last-updated:set', this.form.id)
|
||||
|
@ -404,7 +404,7 @@ export default {
|
|||
this.isLoadingQuestions = true
|
||||
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.3/question/clone/{id}', { id }))
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/question/clone/{id}', { id }))
|
||||
const question = OcsResponse2Data(response)
|
||||
|
||||
this.form.questions.push(Object.assign({
|
||||
|
@ -432,7 +432,7 @@ export default {
|
|||
const newOrder = this.form.questions.map(question => question.id)
|
||||
|
||||
try {
|
||||
await axios.put(generateOcsUrl('apps/forms/api/v2.2/question/reorder'), {
|
||||
await axios.put(generateOcsUrl('apps/forms/api/v2.4/question/reorder'), {
|
||||
formId: this.form.id,
|
||||
newOrder,
|
||||
})
|
||||
|
|
|
@ -402,7 +402,7 @@ export default {
|
|||
logger.debug(`Loading results for form ${this.form.hash}`)
|
||||
|
||||
try {
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.2/submissions/{hash}', { hash: this.form.hash }))
|
||||
const response = await axios.get(generateOcsUrl('apps/forms/api/v2.4/submissions/{hash}', { hash: this.form.hash }))
|
||||
|
||||
let loadedSubmissions = OcsResponse2Data(response).submissions
|
||||
const loadedQuestions = OcsResponse2Data(response).questions
|
||||
|
@ -489,7 +489,7 @@ export default {
|
|||
return
|
||||
}
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.1/submissions/export'),
|
||||
const response = await axios.post(generateOcsUrl('apps/forms/api/v2.4/submissions/export'),
|
||||
{ hash: this.form.hash, path: this.form.filePath, fileFormat: this.form.fileFormat },
|
||||
)
|
||||
showSuccess(t('forms', 'Export successful to {file}', { file: OcsResponse2Data(response) }))
|
||||
|
@ -503,7 +503,7 @@ export default {
|
|||
this.loadingResults = true
|
||||
|
||||
try {
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.2/submission/{id}', { id }))
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.4/submission/{id}', { id }))
|
||||
showSuccess(t('forms', 'Submission deleted'))
|
||||
const index = this.form.submissions.findIndex(search => search.id === id)
|
||||
this.form.submissions.splice(index, 1)
|
||||
|
@ -524,7 +524,7 @@ export default {
|
|||
this.showConfirmDeleteDialog = false
|
||||
this.loadingResults = true
|
||||
try {
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.2/submissions/{formId}', { formId: this.form.id }))
|
||||
await axios.delete(generateOcsUrl('apps/forms/api/v2.4/submissions/{formId}', { formId: this.form.id }))
|
||||
this.form.submissions = []
|
||||
emit('forms:last-updated:set', this.form.id)
|
||||
} catch (error) {
|
||||
|
|
|
@ -509,7 +509,7 @@ export default {
|
|||
this.loading = true
|
||||
|
||||
try {
|
||||
await axios.post(generateOcsUrl('apps/forms/api/v2.2/submission/insert'), {
|
||||
await axios.post(generateOcsUrl('apps/forms/api/v2.4/submission/insert'), {
|
||||
formId: this.form.id,
|
||||
answers: this.answers,
|
||||
shareHash: this.shareHash,
|
||||
|
|
|
@ -451,7 +451,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testGetForms(array $expected): void {
|
||||
$resp = $this->http->request('GET', 'api/v2.1/forms');
|
||||
$resp = $this->http->request('GET', 'api/v2.4/forms');
|
||||
|
||||
$data = $this->OcsResponse2Data($resp);
|
||||
$data = $this->arrayUnsetId($data);
|
||||
|
@ -484,7 +484,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testGetSharedForms(array $expected): void {
|
||||
$resp = $this->http->request('GET', 'api/v2.1/shared_forms');
|
||||
$resp = $this->http->request('GET', 'api/v2.4/shared_forms');
|
||||
|
||||
$data = $this->OcsResponse2Data($resp);
|
||||
$data = $this->arrayUnsetId($data);
|
||||
|
@ -560,7 +560,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testGetNewForm(array $expected): void {
|
||||
$resp = $this->http->request('POST', 'api/v2.2/form');
|
||||
$resp = $this->http->request('POST', 'api/v2.4/form');
|
||||
$data = $this->OcsResponse2Data($resp);
|
||||
|
||||
// Store for deletion on tearDown
|
||||
|
@ -782,7 +782,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testUpdateFormProperties(array $expected): void {
|
||||
$resp = $this->http->request('PATCH', 'api/v2.2/form/update', [
|
||||
$resp = $this->http->request('PATCH', 'api/v2.4/form/update', [
|
||||
'json' => [
|
||||
'id' => $this->testForms[0]['id'],
|
||||
'keyValuePairs' => [
|
||||
|
@ -857,7 +857,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testCreateNewQuestion(array $expected): void {
|
||||
$resp = $this->http->request('POST', 'api/v2.2/question', [
|
||||
$resp = $this->http->request('POST', 'api/v2.4/question', [
|
||||
'json' => [
|
||||
'formId' => $this->testForms[0]['id'],
|
||||
'type' => 'short',
|
||||
|
@ -897,7 +897,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $fullFormExpected
|
||||
*/
|
||||
public function testUpdateQuestionProperties(array $fullFormExpected): void {
|
||||
$resp = $this->http->request('PATCH', 'api/v2.2/question/update', [
|
||||
$resp = $this->http->request('PATCH', 'api/v2.4/question/update', [
|
||||
'json' => [
|
||||
'id' => $this->testForms[0]['questions'][0]['id'],
|
||||
'keyValuePairs' => [
|
||||
|
@ -939,7 +939,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $fullFormExpected
|
||||
*/
|
||||
public function testReorderQuestions(array $fullFormExpected): void {
|
||||
$resp = $this->http->request('PUT', 'api/v2.2/question/reorder', [
|
||||
$resp = $this->http->request('PUT', 'api/v2.4/question/reorder', [
|
||||
'json' => [
|
||||
'formId' => $this->testForms[0]['id'],
|
||||
'newOrder' => [
|
||||
|
@ -991,7 +991,7 @@ class ApiV2Test extends TestCase {
|
|||
}
|
||||
|
||||
public function testCloneQuestion() {
|
||||
$resp = $this->http->request('POST', 'api/v2.3/question/clone/' . $this->testForms[0]['questions'][0]['id']);
|
||||
$resp = $this->http->request('POST', 'api/v2.4/question/clone/' . $this->testForms[0]['questions'][0]['id']);
|
||||
$data = $this->OcsResponse2Data($resp);
|
||||
$this->testForms[0]['questions'][] = $data;
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testCreateNewOption(array $expected): void {
|
||||
$resp = $this->http->request('POST', 'api/v2.2/option', [
|
||||
$resp = $this->http->request('POST', 'api/v2.4/option', [
|
||||
'json' => [
|
||||
'questionId' => $this->testForms[0]['questions'][1]['id'],
|
||||
'text' => 'A new Option.'
|
||||
|
@ -1058,7 +1058,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $fullFormExpected
|
||||
*/
|
||||
public function testUpdateOptionProperties(array $fullFormExpected): void {
|
||||
$resp = $this->http->request('PATCH', 'api/v2.2/option/update', [
|
||||
$resp = $this->http->request('PATCH', 'api/v2.4/option/update', [
|
||||
'json' => [
|
||||
'id' => $this->testForms[0]['questions'][1]['options'][0]['id'],
|
||||
'keyValuePairs' => [
|
||||
|
@ -1123,7 +1123,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testAddShare(array $expected) {
|
||||
$resp = $this->http->request('POST', 'api/v2.2/share', [
|
||||
$resp = $this->http->request('POST', 'api/v2.4/share', [
|
||||
'json' => [
|
||||
'formId' => $this->testForms[0]['id'],
|
||||
'shareType' => 0,
|
||||
|
@ -1159,7 +1159,7 @@ class ApiV2Test extends TestCase {
|
|||
* @param array $fullFormExpected
|
||||
*/
|
||||
public function testUpdateShare(array $fullFormExpected) {
|
||||
$resp = $this->http->request('PATCH', 'api/v2.2/share/update', [
|
||||
$resp = $this->http->request('PATCH', 'api/v2.4/share/update', [
|
||||
'json' => [
|
||||
'id' => $this->testForms[0]['shares'][0]['id'],
|
||||
'keyValuePairs' => [
|
||||
|
@ -1416,7 +1416,7 @@ CSV
|
|||
* @param array $submissionsExpected
|
||||
*/
|
||||
public function testInsertSubmission(array $submissionsExpected) {
|
||||
$resp = $this->http->request('POST', 'api/v2.2/submission/insert', [
|
||||
$resp = $this->http->request('POST', 'api/v2.4/submission/insert', [
|
||||
'json' => [
|
||||
'formId' => $this->testForms[0]['id'],
|
||||
'answers' => [
|
||||
|
|
Загрузка…
Ссылка в новой задаче