<@ULVA73B9P> I use the API endpoint to create flow...
# ask-marvin
b
@Marvin I use the API endpoint to create flow runs from the existing deployment : api/deployments/<deployment-id>/create_flow_run. According to the documentation the response status for a successful trigger is 200, but in my case I get 201 even though everything goes as it should. Do you have any hint why this happens? The app that uses this endpoint does not recognise the 201 response as successful.
m
The status code 201 is typically used in HTTP to indicate that something new was successfully created as a result of the request. In the context of the Prefect API, receiving a 201 status code when creating a flow run from a deployment would suggest that the flow run was successfully created, and the API is confirming the creation of this new resource. HTTP status code 200, on the other hand, typically indicates that the request has succeeded, but it is generally used for successful requests where the result of the request can immediately be found in the payload of the response (such as retrieving information or updating resources). It's possible that the documentation you are referring may not have been updated to reflect that creating a flow run will produce a 201 status code. Unfortunately, I didn't find specific documentation related to the exact status code you can expect from this endpoint in the search results provided. If your application only recognizes a 200 status code as successful, you might need to modify the application to also treat a 201 status as a success. This is a common pattern for REST APIs where actions resulting in the creation of resources result in a 201 status code. If you need further clarification or have other questions about Prefect, please let me know, and I'd be happy to assist. If you believe there is a discrepancy in the documentation, you can also raise this issue on the Prefect GitHub repository.
b
@Marvin can you check the swagger spec for that endpoint, what is the response status for a successful flow creation using deployment id, specifically api/deployments/<deployment-id>/create_flow_run?
m
I apologize for the inconvenience. It seems there is an issue with retrieving information regarding the Prefect API Swagger documentation at the moment. As an alternative, I suggest checking the official Prefect documentation or the Swagger UI if Prefect provides one. Usually, the Swagger UI will list all available endpoints along with the expected request and response structures, including status codes. This information should provide you with definitive answers regarding the expected status code for the creation of a flow run using a deployment ID. If this is a critical issue for your application, you should access the Prefect API's Swagger UI directly (often available at the API root URL, such as
/docs
or
/swagger
) or consult with the official Prefect documentation. Since I cannot fetch the information directly right now, if you have access to the Prefect API or the Prefect UI, it's the best course of action to find the Swagger specification for the endpoint in question. If you face any difficulties or if there's anything else I can assist you with, please let me know.
b
@Marvin there is a missmatch between the response status code i receive and the options defined in the Swagger API docs
m
It appears that there is no specific issue on GitHub that mentions a mismatch between the response status code you receive and the options defined in the Swagger API documentation for the
create_flow_run
endpoint. The search did not yield any results relevant to this discrepancy. However, since you have noticed a disparity between the actual response status code and the ones outlined in the API specs, this could be a concern worth bringing up with the Prefect team. If this discrepancy is causing issues for your implementation, and the documentation does not reflect the actual behavior of the API, I recommend opening an issue in the PrefectHQ repository on GitHub. This way, the Prefect team can address the mismatch and ensure that the documentation is accurate and up-to-date. Please let me know if there's anything else I can do to help.