Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
App builder: Connecting API, Post requests greyed out
posted

Good afternoon,
I am trying to connect my API to the app builder and when I do I see

I can link my get apis, and these are working as expected but the post requests I have are all greyed out.

Below is the post method within my asp.net api

        [HttpPost("addIngredient")]
        public async Task<ActionResult<Guid>> addIngredient([FromBody] NewIngredient ingredient){

            var newId = new OutputParameter<Guid?>();
            var allergenId = new OutputParameter<Guid?>();
            var nutrientId = new OutputParameter<Guid?>();

            Guid libraryId = new Guid("CDDF26FE-D224-4916-8060-33F62E48F95E"); 
            Guid groupId = new Guid("7993BFEE-E676-4A9A-A476-026953FB1594"); 

            if (ingredient == null)
            {
                return BadRequest();
            }
            else
            {
                 await _foodDataServicesContext.GetProcedures().usp_InsertOrUpdateIngredientAsync(null,libraryId, groupId, ingredient.foodCode, ingredient.displayName, ingredient.displayName, "Description", 0, 0, 0, 0, 0, ingredient.costPerKilo, ingredient.internalReference, newId);
                foreach (AllergenIngredient allergen in ingredient.allergens)
                {
                    await _foodDataServicesContext.GetProcedures().usp_Allergen_Ingredient_Link_InsertAsync(new Guid(allergen.AllergenId), newId._value, allergenId);
                }
                foreach (NutrientIngredientValue nutrientValue in ingredient.nutrients)
                  {
                    await _foodDataServicesContext.GetProcedures().usp_Nutrient_Ingredient_Values_InsertAsync(new Guid(nutrientValue.NutrientId), newId._value, nutrientValue.NutrientValue, nutrientId);           
                  }
                 

                return Ok(newId._value);


            }

I wondered if I am doing anything wrong, or if there is anything else that is needed to ensure the app builder can connect to the api correctly.

Thnaks

  • 100
    Offline posted

    Hi Jake,

    App Builder currently expects the full entity to be returned by the endpoint.
    Any chance that you can refactor to return the Ingredient instead of only the GUID?

    Regards,
    Pablo