Шаблон:ApiEx/da

Материал из База знаний VINTEO

<languages/> {{#switch: | =

{{#if:|{{#ifeq:|no||Шаблон:Collapse top}}

Post parameters
Parameter name Værdi Standard Kommentar

|{{#if:|{{#ifeq:|no||Шаблон:Collapse top}}}} }}

{{#if:|{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default=

 {{#switch:

| =

{{#if:|{{#ifeq:|no||Шаблон:Collapse top}}

Post parameters
Parameter name Værdi Standard Kommentar

|{{#if:|{{#ifeq:|no||Шаблон:Collapse top}}}} }}

{{#if:|{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default=

 Ошибка Lua: expandTemplate: template loop detected.

}} }} {{#switch:<translate></translate> | =

Документация шаблона

Use this template on API documentation pages to format an example API request.

Note as an alternative, Шаблон:Tl transcludes localized API documentation generated from source code which normally has API examples in it.

User:SPage (WMF)/ApiEx utility creates a Шаблон:Tl template invocation if you paste an api.php URL into it.

Usage

{{ApiEx
| desc=Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...
| p1=action=query
| p2=titles=Project:articleA{{!}}article_B
| result=<source lang="xml">
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
</source>
| post={{ApiEx/Post|parameter=days|value=integer|default=7|comment=comment}}
}}

Parameters

  • desc - API request description
  • lang - two-letter code for the wiki language. 'en' by default.
  • site - full URL of site to use in example (e.g., www.mediawiki.org). Overrides lang parameter.
  • p1-p9 - parameter groups, each containing either one param=value pair or multiple pairs each separated by an ampersand (&), e.g. p3=param=value&paramB=valueBbbb
  • result - the result of the query execution. Add the template, preview, click the api.php link, and copy and paste the API response into the template as
    | result=<source lang="javascript">PASTE RESPONSE HERE</source>
  • post - a "list" of Шаблон:Tl objects, to generate a post table
  • collapse - set to "no" to stop "result" and "post" sections from being collapsed with Шаблон:Tl/Шаблон:Tl
  • apisandbox - whether to show a "[try in ApiSandbox]" link that loads the example API query parameters into Special:ApiSandbox. Default is 1, add | apisandbox=0 to not show this link.

Notes

  • This template outputs a wikitext link. Any spaces in the URL parameters p1...p9 will garble the link, so change them to %20.
  • Similarly, any pipe-separate values in the URL parameters such as a group of pages "title1|title2" must be escaped, so use the {{!}} magic word.

Example

{{#switch:<translate></translate> | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...

{{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}
<translate> Post parameters</translate>
<translate> Parameter name</translate> <translate> Value</translate> <translate> Default</translate> <translate> Comment</translate>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment
|{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= {{#switch: | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ... {{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}
Post parameters
Parameter name Værdi Standard Kommentar
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment
|{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= Ошибка Lua: expandTemplate: template loop detected. }} }}

| #default=

 {{#switch:

| =

Документация шаблона

Use this template on API documentation pages to format an example API request.

Note as an alternative, Шаблон:Tl transcludes localized API documentation generated from source code which normally has API examples in it.

User:SPage (WMF)/ApiEx utility creates a Шаблон:Tl template invocation if you paste an api.php URL into it.

Usage

{{ApiEx
| desc=Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...
| p1=action=query
| p2=titles=Project:articleA{{!}}article_B
| result=<source lang="xml">
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
</source>
| post={{ApiEx/Post|parameter=days|value=integer|default=7|comment=comment}}
}}

Parameters

  • desc - API request description
  • lang - two-letter code for the wiki language. 'en' by default.
  • site - full URL of site to use in example (e.g., www.mediawiki.org). Overrides lang parameter.
  • p1-p9 - parameter groups, each containing either one param=value pair or multiple pairs each separated by an ampersand (&), e.g. p3=param=value&paramB=valueBbbb
  • result - the result of the query execution. Add the template, preview, click the api.php link, and copy and paste the API response into the template as
    | result=<source lang="javascript">PASTE RESPONSE HERE</source>
  • post - a "list" of Шаблон:Tl objects, to generate a post table
  • collapse - set to "no" to stop "result" and "post" sections from being collapsed with Шаблон:Tl/Шаблон:Tl
  • apisandbox - whether to show a "[try in ApiSandbox]" link that loads the example API query parameters into Special:ApiSandbox. Default is 1, add | apisandbox=0 to not show this link.

Notes

  • This template outputs a wikitext link. Any spaces in the URL parameters p1...p9 will garble the link, so change them to %20.
  • Similarly, any pipe-separate values in the URL parameters such as a group of pages "title1|title2" must be escaped, so use the {{!}} magic word.

Example

{{#switch:<translate></translate> | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...

{{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}
<translate> Post parameters</translate>
<translate> Parameter name</translate> <translate> Value</translate> <translate> Default</translate> <translate> Comment</translate>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment
|{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= {{#switch: | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ... {{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}
Post parameters
Parameter name Værdi Standard Kommentar
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment
|{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#if:
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= Ошибка Lua: expandTemplate: template loop detected. }} }}

| #default=

 Ошибка Lua: expandTemplate: template loop detected.

}}{{#if:Use this template on API documentation pages to format an example API request.

Note as an alternative, Шаблон:Tl transcludes localized API documentation generated from source code which normally has API examples in it.

User:SPage (WMF)/ApiEx utility creates a Шаблон:Tl template invocation if you paste an api.php URL into it.

Usage

{{ApiEx
| desc=Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...
| p1=action=query
| p2=titles=Project:articleA{{!}}article_B
| result=<source lang="xml">
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
</source>
| post={{ApiEx/Post|parameter=days|value=integer|default=7|comment=comment}}
}}

Parameters

  • desc - API request description
  • lang - two-letter code for the wiki language. 'en' by default.
  • site - full URL of site to use in example (e.g., www.mediawiki.org). Overrides lang parameter.
  • p1-p9 - parameter groups, each containing either one param=value pair or multiple pairs each separated by an ampersand (&), e.g. p3=param=value&paramB=valueBbbb
  • result - the result of the query execution. Add the template, preview, click the api.php link, and copy and paste the API response into the template as
    | result=<source lang="javascript">PASTE RESPONSE HERE</source>
  • post - a "list" of Шаблон:Tl objects, to generate a post table
  • collapse - set to "no" to stop "result" and "post" sections from being collapsed with Шаблон:Tl/Шаблон:Tl
  • apisandbox - whether to show a "[try in ApiSandbox]" link that loads the example API query parameters into Special:ApiSandbox. Default is 1, add | apisandbox=0 to not show this link.

Notes

  • This template outputs a wikitext link. Any spaces in the URL parameters p1...p9 will garble the link, so change them to %20.
  • Similarly, any pipe-separate values in the URL parameters such as a group of pages "title1|title2" must be escaped, so use the {{!}} magic word.

Example

{{#switch:<translate></translate> | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...

{{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}

<translate> Post parameters</translate>
<translate> Parameter name</translate> <translate> Value</translate> <translate> Default</translate> <translate> Comment</translate>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment

|{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= {{#switch: | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...

{{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}

Post parameters
Parameter name Værdi Standard Kommentar
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment

|{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= Ошибка Lua: expandTemplate: template loop detected. }} }}| [[Category:Template documentation pages{{#translation:}}]] }} }}{{#if:Use this template on API documentation pages to format an example API request. Note as an alternative, Шаблон:Tl transcludes localized API documentation generated from source code which normally has API examples in it. User:SPage (WMF)/ApiEx utility creates a Шаблон:Tl template invocation if you paste an api.php URL into it.

Usage

{{ApiEx
| desc=Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...
| p1=action=query
| p2=titles=Project:articleA{{!}}article_B
| result=<source lang="xml">
<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>
</source>
| post={{ApiEx/Post|parameter=days|value=integer|default=7|comment=comment}}
}}

Parameters

  • desc - API request description
  • lang - two-letter code for the wiki language. 'en' by default.
  • site - full URL of site to use in example (e.g., www.mediawiki.org). Overrides lang parameter.
  • p1-p9 - parameter groups, each containing either one param=value pair or multiple pairs each separated by an ampersand (&), e.g. p3=param=value&paramB=valueBbbb
  • result - the result of the query execution. Add the template, preview, click the api.php link, and copy and paste the API response into the template as
    | result=<source lang="javascript">PASTE RESPONSE HERE</source>
  • post - a "list" of Шаблон:Tl objects, to generate a post table
  • collapse - set to "no" to stop "result" and "post" sections from being collapsed with Шаблон:Tl/Шаблон:Tl
  • apisandbox - whether to show a "[try in ApiSandbox]" link that loads the example API query parameters into Special:ApiSandbox. Default is 1, add | apisandbox=0 to not show this link.

Notes

  • This template outputs a wikitext link. Any spaces in the URL parameters p1...p9 will garble the link, so change them to %20.
  • Similarly, any pipe-separate values in the URL parameters such as a group of pages "title1|title2" must be escaped, so use the {{!}} magic word.

Example

{{#switch:<translate></translate> | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...

{{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}

<translate> Post parameters</translate>
<translate> Parameter name</translate> <translate> Value</translate> <translate> Default</translate> <translate> Comment</translate>
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment

|{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= {{#switch: | = Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ...

{{#if: {{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse top}}

Post parameters
Parameter name Værdi Standard Kommentar
{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment

|{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

|{{#ifeq:|no||Шаблон:Collapse top}}}}

}}

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#if:

<api>
  <query>
    <normalized>
      <n from="Project:articleA" to="Wikipedia:ArticleA" />
      <n from="article_B" to="Article B" />
    </normalized>
    <pages>
      <page ns="4" title="Wikipedia:ArticleA" missing="" />
      <page ns="0" title="Article B" missing="" />
    </pages>
  </query>
</api>

{{#ifeq:|yes|[ }}days{{#ifeq:|yes| ]}} integer 7 comment |{{#ifeq:|no||Шаблон:Collapse bottom}}}} | #default= Ошибка Lua: expandTemplate: template loop detected. }} }}| [[Category:Template documentation pages{{#translation:}}]] }} [[Category:API templates{{#translation:}}]]