Is there any chance to save “id”:214803 from the response back to the entity (this field will have name “Driver id”)
And second question, I can’t find information how to send attached files through the API. I have a files attached to the entity, how I can send all them through the API?
API docs in the system I’m trying to integrate with Fibery says that request should look like this
POST xxxxxxxxxxxxxxxxxx/attachments/
Content-Type: multipart/form-data
{
"name": <string>,
"file": <file>
}
Hi @AlexH
I think I have realised why my solution did not work: response is a string, and needs to be converted to an object in order for the id to be extracted.
The code for the API call to the third party service may not be formed perfectly correctly, since I don’t know enough details. You will probably need to experiment (with postman or whatever) to confirm the correct syntax for this bit:
Now I’m stuck on getting a Token through the Fibery script. As you remember I can get it through the postman, but we need to get it through the fibery by schedule.
This is part of the script, I was told to use either BTOA or Buffer, but non of these are working, it returns boa is not defined or buffer is not defined
Can you show what works in postman (with screen grabs, blurred to hide sensitive info if needed) and we can figure out how to reproduce in Fibery.
Alternatively/as well, can you send the relevant extracts of the api documentation for the third party (super dispatch i presume).
After 2 days of testing and trying different scripts I was able to fix it and get a token! It was necessary to pass client id and client secret in ‘body’ not in headers -Authorization
Sounds like you’re becoming a fully-fledged SW dev!
With respect to the code I provided for file handling, my colleagues (who are smarter than I am) have told me that the code I posted probably only works for some file types and for limited sizes of files
I’m now not sure if it’s possible to transfer a file from Fibery to another tool, unless perhaps the other tool has an API call that allows you to attach/upload a file from a url, rather than by sending a blob/file-stream)
At some point v soon (if not already) we’ll reach the limit of my experience/knowledge/skills in this area, and I might have to pass the baton to someone else
So we are able to get the URL of the file using the script, and I’m trying to get the data or content of the file and play with it, but the response for f2 and f3 returns “undefined” - any suggestions?
Is there any chance to create\receive FormData from the file? Something like this?
const formData = new FormData();
formData.append(‘name’, entity[‘LOAD ID’]);
formData.append(‘file’, new Blob([f2]), fileWithSecret[‘Name’]);
When I’m trying to send request from Postman - it using FormData