Hello,
I’m seeing some behavior that is confusing to me. I am trying to get all the company wells within a project/scenario.
First, I get the unique id of the wells within a project
url_scenario = 'https://api.combocurve.com/v1/projects/[project]/scenarios/[scenario]/well-assignments'
result, has_error = request_with_handling(
URL_SCENARIO, "get", headers=_get_combo_curve_api_token()
)
well_list = result.json()["wells"]
The part is straightforward. Next I want to get the attributes of these wells from our wells endpoint. I chunk this list of wells then send the request. My uncertainty is how to get all wells in my list. The docs suggest I can just send the list directly at the end of the URL. That’s how I’ve tried it, and I get no error from the response, but the return wells do not match what I requested. I can request one individual well, but it doesn’t make sense to hammer the API with 1000s of API calls. Is there a better approach that what I have done?
Here is the code that doesn’t throw an error but returns the wrong well list:
url_wells = 'https://api.combocurve.com/v1/wells'
for idx, well_chunk in enumerate(ichunked(well_ids, chunk_length)):
logging.info(
f"Scenario Wells Pull: Getting chunk "
f"{idx + 1} of {len(well_ids) // chunk_length}"
)
ids = list(well_chunk)
result, has_error = request_with_handling(
URL_WELLS,
"get",
headers=_get_combo_curve_api_token(),
params={"take": chunk_length, "": ids},
)
if has_error:
return well_list_df
wells = pd.DataFrame(result.json())
well_list.append(wells)
Thanks for the input, Jeff.