Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V2]: Possible additions to docs & questions #13

Open
markboulton opened this issue Jan 29, 2018 · 3 comments
Open

[V2]: Possible additions to docs & questions #13

markboulton opened this issue Jan 29, 2018 · 3 comments

Comments

@markboulton
Copy link

I've been working through this trying to add various APIs and working through differing request formats and differing responses. A few questions have arisen, so I'm going to document them here (hopefully to be helpful!)

Manipulating a response
It might be worth putting in the docs that the {{ response }} variable pair includes things like 'limit' and 'order_by'. Took me a little while to figure this out.

** Path based query **
A few APIs I tried did not use a query but a path instead. For example: https://www.someapi.com/posts/[key]/[value]/[value]. Does the plugin deal with queries such as this?

@alecritson
Copy link
Owner

Hey @markboulton

Thanks for the feedback, I think the limit and order_by are specific to whether that's what the API you queried returns (Placid doesn't actually add anything to the response)

I can see the value in a path based query, that's true. When I wrote the plugin it was for version 1 and was loosely just a port of my other Craftcms plugin (I really just wrote it "too see if I could" as I hadn't created a Statamic plugin before). So there are definitely features lacking that could be included.

That said. I'm planning to do a complete rewrite of the plugin when I get a chance, this one will actually include screens within the Admin system. A more OOP approach to the building and sending of requests, I would also like to get OAuth implemented properly to it and just make it so it's easy to add features in the future (like form submitting).

@markboulton
Copy link
Author

This is great news, Alec. Your plans sound exciting! Let me know if I can help at all. Happy to do some legwork kicking the tyres.

@alecritson
Copy link
Owner

I've been looking into the path based query question you had and started working on it, how do you feel about the following?

Say you had your url as: https://jsonplaceholder.typicode.com/{endpoint}/{number}/{type} and in your template:

{{ placid:request handle="posts" :segment-number="1" :segment-endpoint="posts" :segment-type="comments"}}
{{ /placid:request }}

I thought about just having :number="1" but then figured namespacing would be better to avoid conflicts with any request config. But this would then give you https://jsonplaceholder.typicode.com/posts/1/comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants