Hello everyone ! I hope you're all doing well. Aft...
# ask-community
Hello everyone ! I hope you're all doing well. After checking the documentation and dagsters's project, I tried to use Resources but i encounter this error :
Copy code
resource with key 'api_resource' required by op 'get_sfr_phones' was not provided. Please provide a <class 'dagster._core.definitions.resource_definition.ResourceDefinition'> to key 'api_resource'
Here is my resource file :
Copy code
import requests
import json
import pandas as pd
from dagster import resource

class Api_Caller : 
    def query(self, api_endpoint: str, parameters: dict) -> dict : 
        response = requests.get(api_endpoint,
        if response.status_code == 200:
            return response.json()
            print("No data from API")
            return response
def api_query(init_context) :
    return Api_Caller()
and this is how i used it with my asset :
Copy code
from dagster import asset

def get_sfr_phones() -> dict : 
    sfr_api_endpoint = 'deleted'
    params = {
        'universe': 'GP',
        'act': 'OPEN',
        'brand': 'SFR'

    sfr_response = context.resources.api_query.query(sfr_api_endpoint, params)

    return sfr_response
As I have an error, this is not the good to use Resource. Can someone help me ? 🙂 I'll appreciate it a lot. Thank you !
dagster bot responded by community 1
Hi @Amar Litim did you specify the resource key in your Definitions object ?
Refer to the example usage here: https://docs.dagster.io/_apidocs/definitions
thank you i'll this asap 😄
check *
You're welcome!