CREATE PROYECTO GET error 404 - resource not found

Hi…

We have been working with the API,and use it for create projects, and it has been working perfect.

Now we have to create another freeagent account, and we create an app, create contacts by api, and they works perfect.

But now we have been trying to create a project with the api, and it returns
{errors={error={message=Resource not found}}}
error 404 - resource not found

function test(){
var payload2 = { “project”:
{
“name”:“Test Project”,
“contact”:“https://api.freeagent.com/v2/contacts/10352739”,
“budget”:0,
“is_ir35”:false,
“status”:“Active”,
“budget_units”:“Hours”,
“normal_billing_rate”:“0.0”,
“hours_per_day”:“8.0”,
“uses_project_invoice_sequence”:false,
“currency”:“MXN”,
“billing_period”:“hour”,
“include_unbilled_time_in_profitability”:true,

                        }
                      }
          var url = apiUrl + 'proyects'
          var test = FREEAPICDMX.actualTokenCDMX()
        
          var response = UrlFetchApp.fetch(url, {
            headers: {
              Authorization: 'Bearer ' + FREEAPICDMX.actualTokenCDMX(),
              accept: 'application/json'
            },
            payload: JSON.stringify(payload2),
            method: 'POST',
            contentType: 'application/json',
            muteHttpExceptions : true
          });
          var resp = JSON.parse(response.getResponseCode());
          var resp2 = JSON.parse(response.getContentText());
          Logger.log(resp)
          Logger.log(resp2)

}

Thanks for your help.

Hi Oscar,

Thanks for posting on our forum, and sorry to hear you’ve had some trouble creating a project via our API. From the error you’re receiving it sounds like FreeAgent is struggling to find a resource referenced in your payload – looking at what you’re sending in the request body, I think contact is our main suspect here. Are you able to make a successful GET request to /v2/contacts/10352739 to double check that the record still exists and belongs to the company you’re authenticated as?

Best wishes,

Ewa