Create Project
Method: POST
/api/ps/projects
Headers
'Content-Type': 'application/json'
Parameters
title
- title project, requireddescription
- short description, requiredtitleRu
- title project, optionaldescriptionRu
- short description, optionalcategory
- ANDROID, WEB, IOS, OTHER, requiredpublicImage
- url image, requiredurl
- url to website project, optionalurlGitHub
- url to website project, optionalurlSnapcraft
- url to website project, optionalurlDownload
- url to website project, optionalurlYouTube
- url to website project, optionalisPublished
- is public on website, requireduploads
- ids uploads for relations, required
Code samples
await fetch('/api/ps/projects', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Title',
description: 'Description',
titleRu: 'Title',
descriptionRu: 'Description',
category: 'OTHER',
publicImage: 'https://keygenqt.com/images/blog/601076d399c15.jpg',
url: 'https://api.keygenqt.com/',
urlGitHub: 'https://github.com/keygenqt',
urlSnapcraft: 'https://snapcraft.io/',
urlDownload: 'https://keygenqt.com/files/601076d399c15.zip',
urlYouTube: 'https://www.youtube.com/',
isPublished: false,
uploads: [1, 2, 3], // ids uploads for relations
})
}).then(async (response) => {
console.log(response)
})
HTTP response status codes
Status code | Description |
---|---|
200 | OK |
400 | Bad Request |
422 | Form validate |
500 | Internal Error |
Status: 200
{
"id": 1,
"title": "Title",
"description": "Description",
"titleRu": "Title",
"descriptionRu": "Description",
"category": "OTHER",
"publicImage": "https://keygenqt.com/images/blog/61337b11b1300.jpg",
"url": "https://api.keygenqt.com/",
"urlGitHub": "https://github.com/keygenqt",
"urlSnapcraft": 'https://snapcraft.io/',
"urlDownload": 'https://keygenqt.com/files/601076d399c15.zip',
"urlYouTube": 'https://www.youtube.com/',
"isPublished": false,
"createAt": 1661533680528,
"updateAt": 1661533680528,
"uploads": [
{
"id": 1,
"fileName": "d523f3fb-a8fe-49d9-9e67-3ce8b3231037.png",
"fileMime": "image/png",
"originalFileName": "screenshot-17.png",
"createAt": 1661592987307
}
]
}
Status: 400
{
"code": 400,
"message": "Bad Request"
}
Status: 422
{
"code": 422,
"message": "Error update project, please check the correctness of data entry",
"validate": [
{
"filed": "description",
"errors": [
"Size must be between 3 and 500",
"Must not be null and not blank"
]
},
{
"filed": "title",
"errors": [
"Size must be between 3 and 255",
"Must not be null and not blank"
]
}
]
}
Status: 500
{
"code": 500,
"message": "Internal Error"
}