Giter VIP home page Giter VIP logo

Comments (5)

pythondave avatar pythondave commented on August 23, 2024

Ah yes - looks like this is a hangover from changes made in
#11.

I've added this to today's milestone:
https://github.com/pythondave/th-admin/issues?milestone=1

On 9 July 2013 13:09, villarin [email protected] wrote:

API method:
http://pythondave.github.io/th-admin/2/0.4/scaffolding/api/default.html#/job/0

The jobId parameter is not been sent to the api method - an array of
arrays is been sent instead i.e jobid[jobid].


Reply to this email directly or view it on GitHubhttps://github.com//issues/19
.

from th-admin.

pythondave avatar pythondave commented on August 23, 2024

Otto

I'm thinking of tweaking something in relation to this, and would appreciate your thoughts.

For the API calls, I previously both used and passed to you the following (for example):

A1: { jobId: 123 }
B1: { search: "t", statusId: 1, limit: 5 }
C1: { jobId: 123, statusIds: [ 2, 4, 5, 6, 7, 8 ] }
D1: { search: "te", statusId: 1, limit: 5, exclude: { jobId: 123 }}

I changed this (in #11) so I keep the above, but $.param is always applied before I pass them to you. You currently therefore get passed the following (I'm using 'you' as a synonym for 'the server' :) :

A2: jobId=123 (ignoring the jobid[jobid] bug - i.e. this bug)
B2: search=t&statusId=1&limit=5
C2: jobId=123&statusIds%5B%5D=2&statusIds%5B%5D=4&statusIds%5B%5D=5&statusIds%5B%5D=6&statusIds%5B%5D=7&statusIds%5B%5D=8
D2: search=te&statusId=1&limit=5&exclude%5BjobId%5D=123

A and B are typical of most requests and I think/assume are fine. C and D are less typical and don't feel right - I don't know whether you'd yet noticed these.

I'm wondering if we could have an API design rule along the lines of: Rule D - "only simple objects are ever used in get requests" (as in A1 and B1, but not as in C1 and D1).

Before that, here's my related question to you...

Q1: I think the best way forwards is for you to specify what you want to be passed for C2 and D2 (i.e. for http://localhost/th-admin/2/0.4/scaffolding/api/default.html#/applications/1 and http://localhost/th-admin/2/0.4/scaffolding/api/default.html#/teachers/4).

[

In essence, I'm wondering whether I can keep $.param only and change C1 and D1 to something like:

C1: { jobId: 123, statusIds: "2,4,5,6,7,8" }
D1: { search: "te", statusId: 1, limit: 5, excludeJobId: 123 }

...which will mean C2 and D2 automatically become:

C2: jobId=123&statusIds=2,4,5,6,7,8
D2: search=te&statusId=1&limit=5&excludeJobId=123

...but my options depend on your answer to Q1 :)

]

from th-admin.

villarin avatar villarin commented on August 23, 2024

Q1: I think the best way forwards is for you to specify what you want to be
passed for C2 and D2 (i.e. for
http://localhost/th-admin/2/0.4/scaffolding/api/default.html#/applications/1
and
http://localhost/th-admin/2/0.4/scaffolding/api/default.html#/teachers/4).

In essence, I'm wondering whether I can keep $.param only and change C1 and
D1 to something like:

C1: { jobId: 123, statusIds: "2,4,5,6,7,8" }
D1: { search: "te", statusId: 1, limit: 5, excludeJobId: 123 }

Yeap that is perfectly fine - but please keep the statuses as one single
variable - OR basically

C1: { jobId: 123, statusIds: "2,4,5,6,7,8" }
D1: { search: "te", statusIds: "1", limit: 5, excludeJobId: 123 }

That saves an additional request parameter to sanitise and maintain on the
backend...

from th-admin.

pythondave avatar pythondave commented on August 23, 2024

Good stuff - thanks!

Let's go for the 2nd option :)

On 10 July 2013 15:01, villarin [email protected] wrote:

Q1: I think the best way forwards is for you to specify what you want to be
passed for C2 and D2 (i.e. for

http://localhost/th-admin/2/0.4/scaffolding/api/default.html#/applications/1
and
http://localhost/th-admin/2/0.4/scaffolding/api/default.html#/teachers/4).

In essence, I'm wondering whether I can keep $.param only and change C1 and
D1 to something like:

C1: { jobId: 123, statusIds: "2,4,5,6,7,8" }
D1: { search: "te", statusId: 1, limit: 5, excludeJobId: 123 }

Yeap that is perfectly fine - but please keep the statuses as one single
variable - OR basically

C1: { jobId: 123, statusIds: "2,4,5,6,7,8" }
D1: { search: "te", statusIds: "1", limit: 5, excludeJobId: 123 }

That saves an additional request parameter to sanitise and maintain on the
backend...


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-20743859
.

from th-admin.

pythondave avatar pythondave commented on August 23, 2024

Fixed this exact issue and implemented the '2nd option'.

In addition, I added something to the API viewer which shows the 'serialized query data', to make it more obvious what's being sent to the server.

from th-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.