RESTBench / requirements

Minimum requirements that a repository must fulfill
0 stars 1 forks source link

[Requirements] Return a different mime-type #7

Open igorsantos07 opened 7 years ago

igorsantos07 commented 7 years ago

Given the repository main subject (contacts and addresses), I think it would fit quite well here if we ask for a vCard endpoint, like GET /contact/:id.vcf. Additional details on the format can be found at the wikipedia page, but something simple should be required to keep the focus on the API and implementation parts.

igorsantos07 commented 7 years ago

The spec could be as follows:

Request

This should be a simple GET call, as it's only a retrieval of information but in a different format.

Endpoint

It could be implemented as any or as all of the following:

  1. GET /contact/:id.vcf
  2. GET /contact:id with the header Accept: text/vcard

Response

Mime-type

It must respond with Content-type: text/vcard, in plain-text.

Formatting

Here's an example template of the "required" vCard file. Variables are comprised by dollar signs, as $name$:

BEGIN:VCARD
VERSION:4.0
N:$last_name$;$first_name$;;$title$
FN:$first_name$ $last_name$
EMAIL:$email$
ADR;TYPE=HOME,PREF:;;$number$ $street$;$addr_line_2$;$state$;$postal_code$;$country$
END:VCARD
Cayan commented 7 years ago

This is a valid proposal, specially for XML. I'm just not sure if this should be required for an initial version.

igorsantos07 commented 7 years ago

Maybe this could be an optional requirement, although I see it's quite important to understand how different APIs would deal with a specific mime-type request, such as when exporting data.

Cayan commented 7 years ago

I agree. What mime-types do you think we should require? I believe JSON, XML and CSV are the most important ones.