bktag
August 10, 2023, 4:12pm
1
Hello,
I’m trying to check if Flotiq can get integrated using Rest API and it doesn’t look good right now
I don’t know if their API design is good but to get a blog post we need to use the URL:
https://api.flotiq.com/api/v1/content/flotiqBlogPost/blogPostId
A correct API design would have been https://api.flotiq.com/api/v1/content/flotiqBlogPost/?id=blogPostId in my opinion but that’s not the case.
So my question is: Is there a way to send a variable as part of the URL (endpoint)?
Thank you
dejan
August 10, 2023, 6:36pm
2
Hi @bktag
Yes, it’s possible
Inside Request settings, scroll down and find properties, add the new property let’s call it “id” and set default value.
Then in endpoint, do something like this
https://api.flotiq.com/api/v1/content/flotiqBlogPost/${properties->get(‘id’)}
This should be enough, now you can create single-page inside builder
Create new page or use existing
Set the source to the request you’ve created
Set route to include /:id (this is must, because the property you created is id)
We are working on improving variable system. The REST API doesn’t have yet variable popup which would make things easier.
bktag
August 10, 2023, 7:23pm
3
Hi Dejan,
Thank you for your clear answer!
Will have a look and try it
The only problem as I see is that the URL will have the ID. It might work but it will look ugly as the IDs are “flotiqblogpost-12345567889”.
Will check if I can change that in Flotiq.
Too bad their API doesn’t fetch by slug…
Thank you again for your answer
dejan
August 10, 2023, 7:31pm
4
@bktag
Yeah, that’s not ideal. Slug would be much better.
Let me know if you need any help, I can help also with some of setup.
1 Like
bktag
August 11, 2023, 8:38am
5
I just had a try and it doesn’t seem to work.
The property is always null even if I put a default value.
And same in the page, the source is giving 404 result.
This is my settings:
dejan
August 11, 2023, 2:23pm
6
@bktag
Could you share your domain name so I can check what’s going on?
dejan
August 11, 2023, 2:25pm
7
@bktag
It should be this ${properties->get('id')}
instead of ${properties->get(‘id’)}
So the difference is only → '
instead of → ’
bktag
August 11, 2023, 5:20pm
8
I don’t know what I did as it’s always looking like an arrow for me. But it worked in the end
Thank you!
dejan
August 11, 2023, 5:23pm
9
@bktag
The single quotes should not be curved
1 Like