Skip to content

Instantly share code, notes, and snippets.

@cilim
Created November 13, 2018 19:37
Show Gist options
  • Save cilim/5114058a3bc6e5aebe825d7fe2d48bae to your computer and use it in GitHub Desktop.
Save cilim/5114058a3bc6e5aebe825d7fe2d48bae to your computer and use it in GitHub Desktop.
POST /api/v1/jobs
request body
```
{
"data": {
"type": "jobs",
"attributes": {
"address": "14642 Americo Mountain, Waylonfurt Republic of Korea",
"latitude": 40.735216,
"longitude": -73.818167,
"details": "Lucy Apartments",
"status": "unassigned",
"job_type": "default",
"expires_at": "2018-11-13T08:08:24.098Z",
"tasks_attributes": [
{
"title": "Task title",
"description": "Task description"
},
{
"title": "Task title",
"description": "Task description"
}
],
"question_groups_attributes": [
{
"name": "Living room",
"questions_attributes": [
{
"value": "Are there any broken windows?",
"question_type": "text",
"needs_proof": false
}
]
}
]
}
}
}
```
Notice that the `question_groups_attributes` array is actually comprised from the response from the default questions API endpoint
GET /api/v1/default_questions
request body is empty.
response body:
```
{
"data": [
{
"id": "1",
"type": "default_questions",
"attributes": {
"value": "Are there any broken windows?",
"question_type": {
"symbol": "text",
"attributes": {
"name": "Text"
}
},
"needs_proof": false,
"created_at": "2018-11-12T08:08:26.028Z",
"updated_at": "2018-11-12T08:08:26.028Z"
},
"relationships": {
"default_question_group": {
"data": {
"type": "default_question_groups",
"id": "1"
}
}
}
}
],
"included": [
{
"id": "1",
"type": "default_question_groups",
"attributes": {
"name": "Living room"
},
"relationships": {
"default_questions": {
"meta": {
"included": false
}
}
}
}
]
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment