Hi all,
at the moment I’m trying to develop a small API with codeless to store and load custom data in backendless. In our design and concept of the API we wanted to have one URL/Method per datatype.
So simplified lets say I want to store a picture out of my software in backendless and load it later. For this we wanted to have a URL like: domain.tdl/api/<version>/picture/binary. At the moment in codeless I don’t find a way to have multiple HTTP methods (GET, POST, PUT, DELETE) per URL/API method.
Am I missing something? Or will be a way to do so? Otherwise we poorly have to change that in our concept, as I like the fact to have one URL and not multiple URLs like: /picture/getbinary, /picture/putbinary, /picture/deletebinary
Cheers,
Jonas
Hi Jonas
When you create/update your Codeless Method
- you have to define UNIQUE method name in your API Service
- but you can specify the same route with different Rest Method (GET, POST, PUT, DELETE)
http://support.backendless.com/public/attachments/ff2927af5ce79862b4f64cf530ec9b37.png</img>
so, in your case you need to create 4 Methods in your Service
- [ name: “GetPicture”, method: “GET”, route: “/picture/binary” ]
- [ name: “CreatePicture”, method: “POST”, route: “/picture/binary” ]
- [ name: “UpdatePicture”, method: “PUT”, route: “/picture/binary” ]
- [ name: “DeletePicture”, method: “DELETE”, route: “/picture/binary” ]
http://support.backendless.com/public/attachments/12261c4e65333ae6fef465f7bccd7ee9.png</img>
and you can call the method by this routes:
GET: https://{DOMAIN}/{APP ID}/{API KEY}/services/{SERVICE NAME}/picture/binary
POST: https://{DOMAIN}/{APP ID}/{API KEY}/services/{SERVICE NAME}/picture/binary
PUT: https://{DOMAIN}/{APP ID}/{API KEY}/services/{SERVICE NAME}/picture/binary
DELETE: https://{DOMAIN}/{APP ID}/{API KEY}/services/{SERVICE NAME}/picture/binary
http://support.backendless.com/public/attachments/4246f8139173905bdf1285366e31fc6b.png</img>
Regards, Vlad
Hi Vlad,
thats exactly what I need. Thank you very much.
I thought so far that the route has to be unique as well. But now it’s clear.
Best Regards,
Jonas