Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud API POST /accounts/{accountId}/jobs requires all fields in the body (not just the ones that are marked as required in the docs) #451

Closed
1 of 5 tasks
marselasulku opened this issue Nov 10, 2020 · 6 comments
Labels
API This affects one of dbt's APIs improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@marselasulku
Copy link

Describe the bug

In order to successfully create a job via the API, I have to specify all of the fields (including the ones that are not marked as 'required' by the docs). In some cases this means supplying unnecessary information. For example, if I'm create a job that I only intend to trigger via the API, I still have to specify a schedule even though it won't be used.

Steps To Reproduce

Make a POST /accounts/{accountId}/jobs request with the following body:

{
	"account_id": 1,
	"project_id": 100,
	"environment_id": 10,
	"name": "some job",
	"execute_steps": [
		"dbt run"
	],
}

these fields are the ones that are marked as 'required' by the docs

Expected behavior

Should create a job and respond with 200. Instead, it responds with:

{
  "status": {
    "code": 400,
    "is_success": false,
    "user_message": "The request was invalid. Please double check the provided data and try again.",
    "developer_message": ""
  },
  "data": {
    "_model": "HumanReadableJobDefinition",
    "state": "required key not provided",
    "id": "required key not provided",
    "triggers": "required key not provided",
    "schedule": "required key not provided",
    "settings": "required key not provided",
    "dbt_version": "required key not provided"
  }
}

Screenshots and log output

If applicable, add screenshots or log output to help explain your problem.

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

<output goes here>

The operating system you're using:

The output of python --version:

Additional context

Add any other context about the problem here.

@jtcohen6
Copy link
Collaborator

@marselasulku Thanks for opening! It sounds like this is either an issue with the dbt Cloud API, or possibly our API documentation. I'm going to transfer this issue to the docs.getdbt.com repo, which is where we'd make that change.

If this is causing immediate issues for you, I'd recommend sending a message to dbt Cloud support.

@jtcohen6 jtcohen6 transferred this issue from dbt-labs/dbt-core Nov 10, 2020
@marselasulku
Copy link
Author

@jtcohen6 I think this might be an issue with the API. I think the documentation is correct.

For example, schedule is marked as an optional field in the documentation but the API requires it. In the event that I set triggers.schedule to false (like when I dont want the job to run on a schedule), I still have to specify a schedule which is unnecessary / data that is not used

@zxy-zxy
Copy link

zxy-zxy commented Aug 4, 2021

Hello, any updates on this?

@dgreen161
Copy link
Contributor

@jtcohen6 Has this been fixed? It appears that either the documentation is wrong or the API is broken.

I wonder if the endpoint is repointing to the update job by id endpoint since the id field is required. This id won't exist yet since we are creating a new job. Based on this, I don't think it's the documentation that is wrong but instead the API is broken.

@5x-arpit
Copy link

Hello, I got the solution of this and would like to share here. Here's the problem with the create job API is, its taking the "id" field as an input in body which is required field. We need to give value of job id in "id" field but we would not be able to get it in create API so we need to pass null as a value in "id" field for create API.

NOTE: This required field i.e. "id" is not mentioned anywhere in dbt documentation in create job API. For reference -https://docs.getdbt.com/dbt-cloud/api/#operation/createJob

Hope this helps !

@shelgeram07
@arpit-1696

@runleonarun runleonarun added improvement Use this when an area of the docs needs improvement as it's currently unclear API This affects one of dbt's APIs labels Jan 19, 2023
@runleonarun
Copy link
Collaborator

Closing this issue as it looks fixed in the API docs. Thank you for opening it and raising the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This affects one of dbt's APIs improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
Development

No branches or pull requests

6 participants