We have recorded an API with a particular key valu...
# wiremock-java
y
We have recorded an API with a particular key value that is empty. Even if we perform an action afterward, the API call is still initiated with the empty value. How can we resolve this? "{ "request": { "urlPathPattern": "/api/v3/contacts/contactpersons", "method": "GET", "bodyPatterns": null, "queryParameters": { "contact_type": { "matches": ".*" }, "ozs_name": { "matches": ".*" }, "ozs_user_name": { "matches": ".*" }, "organization_id": { "matches": ".*" }, "email_contains": { "matches": ".*" }, "user_agent": { "matches": ".*" }, "status": { "matches": ".*" } }, "formParameters": {} }, "response": { "jsonBody": { "code": "0", "instrumentation": { "query_execution_time": "0", "response_write_time": "5", "page_context_write_time": "0", "request_handling_time": "40" }, "message": "success", "page_context": { "per_page": "200", "sort_column": "contact_person_id", "has_more_page": "false", "page": "1", "report_name": "Contact Persons", "sort_order": "A", "search_criteria": [ { "comparator": "equal", "column_name": "contact_type", "column_name_formatted": "Contact Type", "search_text_formatted": "{{request.query.contact_type}}", "search_text": "{{request.query.contact_type}}" }, { "comparator": "contains", "column_name": "email", "column_name_formatted": "Email", "search_text_formatted": "{{request.query.email_contains}}", "search_text": "{{request.query.email_contains}}" }, { "comparator": "equal", "column_name": "status", "column_name_formatted": "Status", "search_text_formatted": "{{request.query.status}}", "search_text": "{{request.query.status}}" } ] }, "contact_persons": [ { "created_time": "06 Nov 2024", "contact_name": "test123 test123", "mobile": "", "last_name": "test123", "contact_person_id": "248858000000131019", "is_primary_contact": "true", "contact_id": "248858000000131017", "currency_code": "USD", "skype": "", "phone": "", "created_time_formatted": "06 Nov 2024", "salutation": "", "designation": "", "department": "", "fax": "", "first_name": "test123", "email": "abdulrazzak.m@{{request.query.email_contains}}" }, { "created_time": "06 Nov 2024", "contact_name": "test123 testfake", "mobile": "", "last_name": "testfake", "contact_person_id": "248858000000138015", "is_primary_contact": "true", "contact_id": "248858000000138013", "currency_code": "USD", "skype": "", "phone": "", "created_time_formatted": "06 Nov 2024", "salutation": "", "designation": "", "department": "", "fax": "", "first_name": "test123", "email": "abdulrazzak.m@{{request.query.email_contains}}" }, { "created_time": "07 Nov 2024", "contact_name": "test123 test123", "mobile": "", "last_name": "testfake3", "contact_person_id": "248858000000152007", "is_primary_contact": "false", "contact_id": "248858000000131017", "currency_code": "USD", "skype": "", "phone": "", "created_time_formatted": "07 Nov 2024", "salutation": "", "designation": "", "department": "", "fax": "", "first_name": "testhgfake", "email": "testfake420@{{request.query.email_contains}}" }, { "created_time": "07 Nov 2024", "contact_name": "test123 test123", "mobile": "", "last_name": "wedwer", "contact_person_id": "248858000000152019", "is_primary_contact": "false", "contact_id": "248858000000131017", "currency_code": "USD", "skype": "", "phone": "", "created_time_formatted": "07 Nov 2024", "salutation": "", "designation": "", "department": "", "fax": "", "first_name": "asads", "email": "das@{{request.query.email_contains}}" } ] }, "transformers": [ "response-template", "API_Mock_InMemoryTransformer" ], "transformerParameters": { "entity": "contactpersons" } } }" second response:
Copy code
{
  "request": {
    "urlPathPattern": "/api/v3/contacts/contactpersons",
    "method": "GET",
    "bodyPatterns": null,
    "queryParameters": {
      "contact_type": {
        "matches": ".*"
      },
      "ozs_name": {
        "matches": ".*"
      },
      "ozs_user_name": {
        "matches": ".*"
      },
      "organization_id": {
        "matches": ".*"
      },
      "user_agent": {
        "matches": ".*"
      },
      "email": {
        "matches": ".*"
      },
      "status": {
        "matches": ".*"
      }
    },
    "formParameters": {}
  },
  "response": {
    "jsonBody": {
      "code": "0",
      "instrumentation": {
        "query_execution_time": "0",
        "response_write_time": "0",
        "page_context_write_time": "0",
        "request_handling_time": "96"
      },
      "message": "success",
      "page_context": {
        "per_page": "200",
        "sort_column": "contact_person_id",
        "has_more_page": "false",
        "page": "1",
        "report_name": "Contact Persons",
        "sort_order": "A",
        "search_criteria": [
          {
            "comparator": "equal",
            "column_name": "contact_type",
            "column_name_formatted": "Contact Type",
            "search_text_formatted": "{{request.query.contact_type}}",
            "search_text": "{{request.query.contact_type}}"
          },
          {
            "comparator": "equal",
            "column_name": "email",
            "column_name_formatted": "Email",
            "search_text_formatted": "{{request.query.email}}",
            "search_text": "{{request.query.email}}"
          },
          {
            "comparator": "equal",
            "column_name": "status",
            "column_name_formatted": "Status",
            "search_text_formatted": "{{request.query.status}}",
            "search_text": "{{request.query.status}}"
          }
        ]
      },
      "contact_persons": []
    },
    "transformers": [
      "response-template",
      "API_Mock_InMemoryTransformer"
    ],
    "transformerParameters": {
      "entity": "contactpersons"
    }
  }
}
l
Hi, I am sorry but I am not sure what the problem is based off of your description. Could you give more details about what you are trying to achieve? What is the key value that is empty?
So are you saying
contact_persons[]
should be present in both the first and second responses?
y
yes. but it's empty in second response
l
And you are certain it is actually present in the responses from the API you are recording ?
Also could you give some information about what the
API_Mock_InMemoryTransformer
is ?
y
it's an internal script
l
Would this impact the response you are seeing in your stubs ?
y
no it's won't impact