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

Save() function doesn't handle update function #653

Open
sadiqk2 opened this issue Aug 23, 2024 · 10 comments
Open

Save() function doesn't handle update function #653

sadiqk2 opened this issue Aug 23, 2024 · 10 comments
Labels

Comments

@sadiqk2
Copy link

sadiqk2 commented Aug 23, 2024

I am using save function for updating relationship and saving new relationship but it doesn't update rather insert new relationship always
Similarly it doesn't save bank account collection with account model.

@remkobrenters
Copy link
Collaborator

If I understand you correctly this is how Exact Online works. On creation it saves new entities and from that point on you have to update them through their own endpoints (and not through an update of the parent record). See for example https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=PurchasePurchaseInvoices and than the fields for POST and PUT. You see that the invoice lines are not there for the PUT request.

@sadiqk2
Copy link
Author

sadiqk2 commented Aug 27, 2024

i am trying to save bankAccounts in account model ,its doesnt get save
anything i am missing
$account->bankAccounts = collection of bank account (same way like sales entry lines)
it doesnt get save
rest account details are saved except the bank account

@remkobrenters
Copy link
Collaborator

Bank accounts cannot be saved as collection (look here https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=CRMAccounts) and filter it by POST. You will see there are no bank accounts. They need to be added separately after creating the account.

@sadiqk2
Copy link
Author

sadiqk2 commented Aug 27, 2024

image
i check the account model ,there it can accept as a collection of bank account

@remkobrenters
Copy link
Collaborator

Correct. The models are generated based on the Exact Online API documentation. It shows the definition of the entire model that is available and does not specify the differences between the different states (for example the ID is also not available as long as it is not created etc).

You should use the Exact Online API documentation to pinpoint what is available and allowed for POST, PUT etc.

@sadiqk2
Copy link
Author

sadiqk2 commented Aug 27, 2024

shouldnt we remove it ,i can submit the pr then
to avoid the confusion

@remkobrenters
Copy link
Collaborator

Not really as it is representing the model and it's properties (value, type and description). It helps when using the fields. To make sure your fields work the way you want the Exact Online API documentation should be used. As they constantly change things there one of the community members (@DannyvdSluijs ) created a awesome solution that parses the Exact Online API documentation and generates a PR for all changes in these properties. An example of these changes can be seen here #635

So manually removing or changing the property definitions is not a viable solution.

@sadiqk2
Copy link
Author

sadiqk2 commented Aug 27, 2024

ah i see ,that's cool
i am trying to send findId by contact name and contact name in exact is already saved as(testing O'husbson) or other ascii characters
whenever we try to url encode it doesnt find the correct name rather makes it return null means it doesnt exists.
now if i dont urlencode it does break the request with syntax error ,
what we can do to fix this type of issue here

@remkobrenters
Copy link
Collaborator

I am not sure I understand what you try to do with findId() in relation to the contact name. For searching using for example filter() please keep in mind that Exact Online uses oData so your filters (and other arguments) need to use the oData structure and notation.

See also https://support.exactonline.com/community/s/knowledge-base#All-All-DNO-Simulation-query-string-options

@DannyvdSluijs
Copy link
Contributor

Not really as it is representing the model and it's properties (value, type and description). It helps when using the fields. To make sure your fields work the way you want the Exact Online API documentation should be used. As they constantly change things there one of the community members (@DannyvdSluijs ) created a awesome solution that parses the Exact Online API documentation and generates a PR for all changes in these properties. An example of these changes can be seen here #635

So manually removing or changing the property definitions is not a viable solution.

Thanks for the gentle ping, here is once again a PR based on the latests documentation, #656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants