How to use online API ?
Posted: Mon Oct 17, 2022 11:56 am
Hello,
I work in the electronics industry but there is a lot of tension on the supply of components.
A reseller I order a lot from is called MOUSER and provides an API to run search queries which would be really great for tracking the amount of components still available.
They have examples where I can input a part number like the STM32F407VET6 like that :
the generated querie gives that (I have hidden the api key) :
I have several questions :
How to manage strings with several symbols """" ?? if I create a single variable with the entire URL, purebasic does not like it.
how can i generate this command with Purebasic ?
I will try with that one : HTTPRequest(Type, URL$ [, Data$ [, Options [, EnTetes()]]]) but I don't know what is sent by purebasic.
Is the "post" command sent by HTTPRequest ? Or should I add it to the string "URL$" ?
If anyone has experience in this or an example I'm interested, I'm just starting out with programming Basic and Web language and swimming a bit
Thank you very much
I work in the electronics industry but there is a lot of tension on the supply of components.
A reseller I order a lot from is called MOUSER and provides an API to run search queries which would be really great for tracking the amount of components still available.
They have examples where I can input a part number like the STM32F407VET6 like that :
Code: Select all
{
"SearchByPartRequest": {
"mouserPartNumber": "STM32F407VET6",
"partSearchOptions": "string"
}
}
Code: Select all
curl -X POST "https://api.mouser.com/api/v1/search/partnumber?apiKey=xxxxxxxxxx" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"SearchByPartRequest\": { \"mouserPartNumber\": \"STM32F407VET6\", \"partSearchOptions\": \"string\" }}"
How to manage strings with several symbols """" ?? if I create a single variable with the entire URL, purebasic does not like it.
how can i generate this command with Purebasic ?
I will try with that one : HTTPRequest(Type, URL$ [, Data$ [, Options [, EnTetes()]]]) but I don't know what is sent by purebasic.
Is the "post" command sent by HTTPRequest ? Or should I add it to the string "URL$" ?
If anyone has experience in this or an example I'm interested, I'm just starting out with programming Basic and Web language and swimming a bit

Thank you very much