Create project with CF API - Incomplete info
When I create a new CF Pages project using the API:
https://developers.cloudflare.com/api/operations/pages-project-create-project
The request is successful but when I go to the dashboard I see that the "Builds & deployments" information is missing. And I am sending it in the payload as requested by the API.
The sent payload looks something like this:
I already made sure that all variables are parsed properly and the resulting payload has the desired data. But I still can't see that "Builds & deployments" window when I go to open the dashboard in CF. All this is running in a github action for particular issues of the repository where the applications live.
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
8 Replies
You're missing the "source" object which defines the GitHub/GitLab repo
hey @walshydev when I pass the object "source" inside the payload, I get a 400 saying that
"The request body is incorrect. The request body may have an invalid JSON type or missing required keys. Refer to https://developers.cloudflare.com/api.""
The payload with the source looks like this:
Btw the API documentation, doesn't mention anything about a "source" object.
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
You're passing booleans as a string there
Is there any documentation detailing this? As I mentioned in Pages Project / Create Project, they don't mention anything about the "source" object.
When correcting the boolean, now it says:
"Missing project source configuration. Specify a GitHub/GitLab repository owner and repository name."
But that information is already in the payload in the source object.
Key is
repo_name
not repo
Go SDK has the APIs implemented, you can see types here: https://github.com/cloudflare/cloudflare-go/blob/master/pages_project.go#L20-L51 great! thank you so much, this is so helpful!!!!