0

Very new to Drupal (running 8.5.6) and inherited some code I need to tweak. We invoke the API request like so (which may wrap the Drupal API..I am not sure)

https://api.mysite.org/backend/api/constants/en?_format=json

I get a fairly large JSON object returned. There is a view I created called myview that is returned in the json with the name of view_35. I have two other test instances where I created the same view by name referencing the same fields. But in one instance the name is returned in the JSON as view_38 and in the other view its view_31. I noticed that I could alias the fields. Is there a feature like that for views? In other words, I want to name the view so it can be consistently referenced in the code that consumes the JSON. The client side of the app that invokes the api is Angular, if that makes any difference.

0

The answer was already in the question. Turns out the option to add aliases is exactly the same for other fields...it's just a little counter intuitive. Go to Administration-->Structures-->Views--> Constants view --> Edit --> then select "Constants" from the "Displays" Then select "Settings" next to Show... All the aliases can be entered there. Then save the changes. Now you can reference the view by alias rather than the view_[ID] reference.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.