johnRedden / TextbookProject

Textbook project start.
0 stars 0 forks source link

Parent Query (new API command) #47

Closed johnRedden closed 8 years ago

johnRedden commented 8 years ago

Would like all parent information for any given objective. Give objective ID and get back Section, Chapter and book. Need also the respective order. I think {Title, ID, Order} for all parents of an objective.

Goal>>> to label any objective with standard numbering. Example, maybe this could be used to leave a breadcrumb trail [ Trigonometry >> Chapter 1 >> Section 2.2 >> Objective 2.2.3 ]

Objective 2.2.3 would correspond to chapter 2, section 2, objective 3. Check the book... section 2.2 has 3 objectives.

johnRedden commented 8 years ago

Pinging this...

FelixVicis commented 8 years ago

Left with a few questions. We'll talk about this over tacos.

FelixVicis commented 8 years ago

Return order of parents:

{
book-title: "",
book-id:"",
chapter-title:"",
chapter-id:"",
chapter-order:"",
section-title:"",
section-id:"",
section-order:"",
objective-title:"",
objective-id:"",
objective-order:"",
}

possible call would be /api/parent/:Kind/:ID

FelixVicis commented 8 years ago

Completed

JSON results of parent order is now done. URL is /api/parent/:Kind/:ID

Example output:

{
  "Status": "Success",
  "Reason": "",
  "Code": 0,
  "Results": {
    "BookTitle": "The Bookiest of them All",
    "ChapterTitle": "A Chapter of Chapters",
    "SectionTitle": "The First of no sections",
    "ObjectiveTitle": "The Objective to rule them all",
    "BookID": 6401356696911872,
    "ChapterID": 4993981813358592,
    "SectionID": 6119881720201216,
    "ObjectiveID": 5556931766779904,
    "ChapterOrder": 1,
    "SectionOrder": 2,
    "ObjectiveOrder": 0
  }
}

Example Failure:

{"Status":"Failure","Reason":"Invalid Kind given","Code":406,"Results":null}

Kind is allowed to be any: Book, Chapter, Section, Objective. Failure if none. ID is allowed to be any non-zero integer, failure otherwise.

Check Status or Code before results. Results populated only on success.