Closed seanthepottingshed closed 6 years ago
@seanthepottingshed
which route are you using?
@JackHaK
This could be another API route if it's easy for you.
Revised structure with id
and without first categories
key:
[
{
"title": "Conferences & Seminars",
"slug": "conferences-seminars"
},
{
"title": "Director Development",
"slug": "director-development"
},
{
"title": "Finance",
"slug": "finance",
"categories": [
{
"title": "Insurance",
"slug": "insurance"
},
{
"title": "Banking",
"slug": "banking"
},
{
"title": "Investment",
"slug": "investment"
},
{
"title": "Trust",
"slug": "trust"
},
{
"title": "AML / Compliance",
"slug": "aml-compliance"
},
{
"title": "Corporate Governance",
"slug": "corporate-governance"
},
{
"title": "Accounting",
"slug": "accounting"
}
]
},
{
"title": "IT & eCommerce",
"slug": "it-ecommerce"
},
{
"title": "Law",
"slug": "law"
},
{
"title": "Leadership & Management",
"slug": "leadership-management"
},
{
"title": "Personal Development",
"slug": "personal-development"
},
{
"title": "Project Management",
"slug": "project-management"
},
{
"title": "Sales & Marketing",
"slug": "sales-marketing"
},
{
"title": "University Programmes",
"slug": "university-programmes"
}
]
Hi @seanthepottingshed - Jack and I both looked at this this afternoon as Administrate was giving us the run around with some of the data. We have now changed the service to return what you wanted adding in ID and also moving the array to an object. We have also created slugs but I'm not sure why they would be relevant in the middle tier and we create them on the fly so we need to be careful. Not tied down the regex on them yet so we can tweak as required.
Introduced str_slug to produce slugs.
@PeteHaK @JackHaK
LEGENDS, really appreciated!
OctoberCMS uses it's own Slug generation class which I can't guarantee will generate the same slug as the native Laravel str_slug
function.
@JackHaK
Is it possible to format the Categories endpoint JSON as follows please?
Basically I need to associate images in the CMS side of things with categories, so I need an
id
to o keep things in sync. Also best if the slug is generated on your side to ensure that the same format is used both in the website and the Integration Tier.