Questions tagged [api]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Limit External API Calls From Plugin In Craft 2

I have a plugin in Craft 2 that will make an API call to an external API to gather and display data on a template; however, I would like to limit the number of calls to a certain number per second (or ...
buck1112's user avatar
  • 390
1 vote
2 answers
55 views

Setting up Feed Me with and API Auth Token that changes every 15mins

I have setup a feed using Feed Me and have added the Authorization header token but the API changes the Auth token every 15min. Which I need to copy paste into the config file. Is there an easy setup ...
Stu00's user avatar
  • 13
0 votes
2 answers
24 views

Craft 2 Caching RESTful API Results Displayed On Page

I have made a php plugin in Craft 2 which calls a RESTful API and displays the results on the template. The data is returned at about 8 seconds. I've surrounded the call to the plugin on the ...
buck1112's user avatar
  • 390
0 votes
0 answers
29 views

Feed me config setup

I am trying to do an import of course data into craft but I am running into a problem with the feed me config (feed-me.php). He is the curl request I want to run and this works and outputs the data I ...
bhackett's user avatar
  • 127
0 votes
0 answers
89 views

How to fetch data from pagination URL with Feed Me plugin

I have a pagination URL http://example.com/v3/?limit=12&page=1 I try this code: {% set page = craft.app.request.getParam('p') %} {% set params = { url: 'http://example.com/v3/?limit=12&...
user2707393's user avatar
0 votes
0 answers
22 views

Element api search not returning expected OR condition results

I am passing several params to my element api endpoint in order to search for multiple terms. My OR condition for the criteria seems to return results for only one half of the condition. What am I ...
joomkit's user avatar
  • 2,004
1 vote
1 answer
106 views

Call external API when event is firing

I would like to send a post request to an API when a new order in in Craft Commerce is paid. So I've got this event into a plugin: Event::on( Order::class, OrderStatuses::class,...
Davide's user avatar
  • 35
1 vote
1 answer
288 views

Updating to Craft 4 breaks plugin settings: must not be accessed before initialization

I maintain a plugin. Inside this plugin's composer.json, extra>handle is set to pizza (not the real name). In one of the controllers, the following code is executed: $apiKey = Plugin::$plugin->...
Paul Hübner's user avatar
1 vote
1 answer
116 views

How to generate a token, retrieve it and delete it

I have a workflow were a user will be given a link, with a token attached to it, upon clicking that link, the token will be read from the query string, if it is valid the user will be presented a ...
Wally's user avatar
  • 333
1 vote
0 answers
146 views

Using tokens to authenticate a one-time download link?

I am trying to create a download link to an ASSET in craft that I can send via email - the client clicks the email link (which has a token query string attached to validate the link) and is presented ...
Wally's user avatar
  • 333
1 vote
1 answer
55 views

GraphQL fields with applied typogrify - any suggestions?

we love CraftCMS and also typogrify plugin with Twig filter "|typogrify". Now we are starting a web project that will combine Astro and CraftCMS will be used headless with the use of GraphQL ...
jan.reges's user avatar
1 vote
1 answer
100 views

Configuring Craft 3 with Sparkpost - SMTP - email errors

I created a basic Sparkpost account and am trying to connect it to Craft to send email notifications. When I click the 'test' button in Craft, I get "there was an error testing your email ...
4midori's user avatar
  • 656
1 vote
1 answer
262 views

How to make a external GraphQL API request?

I want to query some data from another domain. I dont want to to do it in JS (client side) because I want the content right in place on the page. I tried with several options and variations with the ...
Simon Franzen's user avatar
1 vote
1 answer
75 views

Returning Metadata Fields with GraphQL?

I'm trying to pull as much information from the CMS as possible via the GraphQL API. I can't seem to find any info about how to extract the metadata information for the various entries in the CMS. At ...
Ailish's user avatar
  • 21
1 vote
1 answer
345 views

Creating an asset from an API using a module

I'm currently making a module that I'm hoping is going to create entries and assets from an API. I've got the entries part working and now I'm trying to create an asset from a URI of an image. I've ...
Jack Nixon's user avatar
0 votes
0 answers
752 views

Maximum Response Size in GraphQL API?

hoping someone can point me in the right direction here. I'm trying to query my client's API with the Graphiql interface. My use case requires me to extract quite a lot of data from their system but ...
Ailish's user avatar
  • 21
1 vote
1 answer
328 views

How does Craft CMS gets data from a 3rd part API?

I have an event page for viewing movies showtime and i want to connect to a 3rd party api to get the movie's info ( show time, cinema name,...etc ) how to do it? can i do this without having to create ...
Ra3d K's user avatar
  • 125
1 vote
1 answer
58 views

Manipulating search event

Looking at a means to perform subqueries against certain searches in the back-end of the Craft CMS eg for searches against particular sections within Admin > Entries. Looking into this it seems ...
Cole Henley's user avatar
  • 1,741
0 votes
0 answers
339 views

Guzzle fatal error using Craft Guzzle client

Using the code below to get 3rd party API $uri = $baseUri . '/area/' . $areaId . '.geojson?api_key=' . $mapAPIkey; $client = Craft::createGuzzleClient(); $response= $client->request('...
joomkit's user avatar
  • 2,004
1 vote
0 answers
45 views

GraphQL API query to load all related data

How to write a query to load entries with its category or any other related data. For example I have cars that related to the BMW category. How I can access the category data in the query that fetch ...
Nasser Ali Karimi's user avatar
1 vote
1 answer
70 views

Element API - lightswitch option to exclude an entry from a feed

I'm trying to exclude an entry based on the state of a lightswitch field in the entry itself. If true, exclude the entry from the feed, if false include the entry.
Alan Kimrey's user avatar
1 vote
1 answer
307 views

Craftcms 3 Module - API call validation (on EVENT_BEFORE_SAVE, EVENT_BEFORE_VALIDATE, EVENT_AFTER_VALIDATE, EVENT_AFTER_SAVE)

I am trying to validate entries on Save in a Module. My specific use case requires that the Entry validation - on failure to validate will return user to form with field errors. On successful ...
matty_rj45's user avatar
1 vote
2 answers
147 views

How to develop API with TWIG

I want to develop an API within Twig template that will have PDO implementation to get data. My application will be using content through CRAFT. Is it possible to develop API with TWIG template? ...
Deepak Kale's user avatar
0 votes
1 answer
257 views

Schedule plugin not working for Feed Me plugin

I have created a schedule to run the 'Feed Me' every 1 minute using the plugin 'Schedule', but it doesn't work. I not sure am I using the correct setting or not. I manage to get the latest data if I ...
Lee's user avatar
  • 139
1 vote
2 answers
708 views

How to query EntryQuery for multiple sections with varying types

I think the best way to pose this question is by giving an example: Given a variable $query of type craft\elements\db\EntryQuery, I'd like to get entries from 2 different sections: "people" ...
Adam Tsai's user avatar
1 vote
1 answer
30 views

Craftnet API package query

Does querying composer packages via the Craftnet API need authentication? Ref https://docs.api.craftcms.com/packages.html Querying the Craft CMS package itself is fine, eg https://api.craftcms.com/v1/...
Cole Henley's user avatar
  • 1,741
0 votes
0 answers
298 views

Rest Controller and API Rate Limits or how to set CSRF token invalid

Problem: I have a JSON endpoint and like to limit access to it. I.e. to prevent double submits on contact forms or brute force attempts. One solution that came to my mind was rate-limiting the ...
nfo's user avatar
  • 101
4 votes
1 answer
973 views

How to accept incoming webhooks?

I've tested the webhooks plugin. Awesome. Works brilliantly. How how about incoming webhooks? What if my 3rd party ERP system has changes that it wants to put into my Craft site. How do I go about ...
nitech's user avatar
  • 679
1 vote
1 answer
1k views

How to correctly format API requests for Mandrill using Fetch plugin? Getting error "you must specify a key value"

I want to use the Fetch plugin (v 1.2.0; Craft Pro 3.3.13) to send messages from a Twig template in some circumstances. To test the setup, I'm just trying to ping Mandrill, according to the /users/...
Katie Fritz's user avatar
2 votes
2 answers
2k views

How to update (or CRUD) products (or entries) via API?

I want to update certain fields of a product (or entry) from a 3rd party. I see some talk about plugins and some refer to this .all talk about Creating a RESTful API with Craft 3. I found the Craft ...
nitech's user avatar
  • 679